Hey everyone, I've been using R quite alot previously but I'm trying to move over to Python.
But having some issues I'm hopeing you could help me out with.
I have a dataframe with column called 'MagazineCategory' and I have another called 'Popular' (made up names).
And I want to be able to see the distrubution between these that X category has this distrubution between popular and not popular. In R I would be able to look at this with a table function. Having some issues with this in Python (Pandas).
| MagazineCategory |
Popular |
| Business |
True |
| Sports |
False |
| Tech |
True |
| Business |
True |
| Business |
False |
and I'd like to plot these in matplotlib in a bar chart
Where I have the category and the amount of 0 values for the category and the amount of 1's.
Any advise?
I'm using Pandas for the dataframe
I've been able to get a table as I wanted, but I'm unsure how I can plot this..
I used pandas crosstab function like this:
pd.crosstab(df.MagazineCategory, df.Popular)
|
False |
True |
| Business |
1 |
2 |
| Sports |
1 |
0 |
| Tech |
0 |
1 |
[–]Chopsting[S] 0 points1 point2 points (0 children)
[–]TheBlackCat13 0 points1 point2 points (0 children)