Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用seaborn进行条形图绘制?_Python_Matplotlib_Seaborn - Fatal编程技术网

Python 如何使用seaborn进行条形图绘制?

Python 如何使用seaborn进行条形图绘制?,python,matplotlib,seaborn,Python,Matplotlib,Seaborn,我有一个数据帧 Store ID Carwash 1 0 1 0 1 0 1 0 2 1 2 1 3 1 3 1 4 0 4 0 我想根据店铺ID绘制洗车图。您可以使用groupby和来自pandas的 df2=df.groupby(['storeid']).count()

我有一个数据帧

Store ID  Carwash
1            0
1            0
1            0
1            0
2            1
2            1
3            1
3            1
4            0
4            0

我想根据店铺ID绘制洗车图。

您可以使用
groupby
和来自pandas的

df2=df.groupby(['storeid']).count()
car_wash=df.groupby(['Store ID']).apply(lambda x:x['Carwash'].unique())
洗车=[洗车时的清单(i)]
ax=df2.绘图(种类='bar')
对于ax.patches中的p:
轴注释(str(car_wash.pop(0)),(p.get_x()*1.005,p.get_height()*1.005))

是否有办法绘制值,即1或0,而不是绘制频率?对不起,你能详细说明一下吗?我想绘制carwash的值,即商店ID的1或0。这就是你要找的吗?