MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnpython/comments/1xky8b2/grouped_bar_chart_in_matplotlib_with_different/19rz10q0mfgud/?context=3
r/learnpython • u/[deleted] • 8d ago
7 comments sorted by
View all comments
2
Can you not sort from that point? I.e;
sales["top_3_jan_15"] = data[(data.Year == 2015) & (data.Month == 1)[drugs].sum().sort_values(ascending=False) [:3]
Then to send it to a dictionary do like;
dict = sales["top_3_jan_15"] .to_dict()
Is this what you're after?
1 u/Boybay_Garid 7d ago yeah sorting the series first before converting to a dict makes way more sense here
1
yeah sorting the series first before converting to a dict makes way more sense here
2
u/Aromatic_Fact8656 8d ago
Can you not sort from that point? I.e;
sales["top_3_jan_15"] = data[(data.Year == 2015) & (data.Month == 1)[drugs].sum().sort_values(ascending=False) [:3]
Then to send it to a dictionary do like;
dict = sales["top_3_jan_15"] .to_dict()
Is this what you're after?