I have a dataframe like this:
and i want to convert it into a dictionary using exactly this format:
Do you guys have an idea on how to do that?
I also tried using df.T.to_dict() but it gives me some problems with the indices as well as a starting and end clip.
I figured it is some nesting problem, but I don't know how get rid of it :/
Please don't mind the harsh comments :) It is for a hate speech detection project!
Also I'm a new user so I don't have the reputation to post snippets directly! Sry for that!


DataFrameandDictionarydata does not match. I mean: thisdataframewith this values I want to transform todictwith this structure. According to this data solution can be:result = comments_df["comments"].to_dict(orient="records"). But without further more info i cannot help.