Attributeerror: 'function' Object Has No Attribute 'bar' In Pandas
I have a pandas data frame which is a pandas data frame type as shown below type(df) Out[176]: pandas.core.frame.DataFrame But when I try to use any plotting functions on this d
Solution 1:
If you have specific columns in mind that you want to plot, you can try:
df.plot(x='x', y='y', kind='bar')
Solution 2:
Interesting, for me it works very well:
df = pd.DataFrame({'ab': {0: 31196, 1: 18804}})
printdf
ab
0 31196
1 18804
#New in version 0.17.0.
df.plot.bar()
Another option:
df.plot(kind='bar')
EDIT (by discussion in chat):
I think you need boxplot
:
#filter columnsdf = df.drop(['city','last_trip_date','phone','signup_date','user_red'], axis=1)
printdf
Retained avg_dist avg_increase avg_price avg_value pct \
0 1 3.67 1.1 5.0 4.7 15.4
1 0 8.26 1.0 5.0 5.0 0.0
2 0 0.77 1.0 5.0 4.3 0.0
trips_in_first_30_days weekday_pct
0 4.0 46.2
1 0.0 50.0
2 3.0 100.0
df.boxplot(by='Retained', layout=(7,1), figsize=(5,15))
Post a Comment for "Attributeerror: 'function' Object Has No Attribute 'bar' In Pandas"