Hello,
I have been trying to use a series that I have got using aggregate function and plot a bar plot but not able to get it. I have quickly got the correct aggregate function, but not able to identify how to get x and y axis for plotting bar plot.
DataFrame is fab1:
indicator has only 0 and 1 values
Objective - **to get a bar plot**
x axis :- periods (1,2,3,4)
y axis :- counts of 0 and 1 for each of the periods. So, a total of 8 bar lines should come
Aggregate function used by me and result:
Raw dataset- few rows
period indicator
0 1 0
1 1 0
2 1 0
3 1 0
4 1 0
5 1 0
6 1 0
7 1 0
8 1 0
9 1 0
.... around 350 observations
just to add that below code gives me output, but how to make customised bar plot.
fab1.groupby(['period','indicator'])['indicator'].count().plot(kind='bar')
I have been trying to use a series that I have got using aggregate function and plot a bar plot but not able to get it. I have quickly got the correct aggregate function, but not able to identify how to get x and y axis for plotting bar plot.
DataFrame is fab1:
indicator has only 0 and 1 values
Objective - **to get a bar plot**
x axis :- periods (1,2,3,4)
y axis :- counts of 0 and 1 for each of the periods. So, a total of 8 bar lines should come
Aggregate function used by me and result:
c1=fab1.groupby(['period','indicator'])['indicator'].count() c1Result is:this one is the correct result. Third column is the count of 0 and 1 for a specific period (column 1). How to build the bar plot/histogram?
Output:period indicator
1 0 61
1 19
2 0 68
1 14
3 0 64
1 18
4 0 53
1 27
Name: indicator, dtype: int64
Now I want to use use the bar plot function to complete my objective, getting stuck. please help meRaw dataset- few rows
period indicator
0 1 0
1 1 0
2 1 0
3 1 0
4 1 0
5 1 0
6 1 0
7 1 0
8 1 0
9 1 0
.... around 350 observations
just to add that below code gives me output, but how to make customised bar plot.
fab1.groupby(['period','indicator'])['indicator'].count().plot(kind='bar')