i would like to convert a dataframe with calculating percentage points for a graph later on in python.
The current frame looks like this
Post ID | Title | Url | Author | Score | Submission_Date | Total_Num_of_Comments | Permalink | Flair | Selftext | TitleAndText | Word Count |
---|---|---|---|---|---|---|---|---|---|---|---|
k4nllk | Update: Whassup bro? | https://www.reddit.com/r/GME/comments/k4nllk/update_whassup_bro/ | matt_xndever | 1 | 2021-01-01 16:58:48 | 13 | /r/GME/comments/k4nllk/update_whassup_bro/ | Hedge Fund Tears | asdasdasd | asdasdasdasd | 59.0 |
Where flairs are the categories i want to look for (over 40). On one submission day (i want to look onto days only), there can be multiple posts with different flairs. These flairs should add up to 100%.
So i want to create a dataframe like that:
Submission_Date | Discussion | Due Diligence | Hedge Fund Tears | News |
---|---|---|---|---|
01.01.2021 | NaN | NaN | 1.0 | NaN |
03.01.2021 | NaN | 0.333333 | 0.666667 | NaN |
My graph should look like this: Plot stacked (100%) bar chart for multiple categories on multiple dates in Python
Can someone help me with the preparation for that?
Thanks and best regards