我想绘制一个特定数字的计数,例如2000

时间:2018-11-18 20:58:54

标签: python dataframe

ax = df_1['neighbourhood'].value_counts().plot(kind='bar', figsize=(14,8),
                                               title="Neighbourhood that showed")
ax.set_xlabel("neighboorhood")
ax.set_ylabel("Frequency")

1 个答案:

答案 0 :(得分:0)

您可以将value_counts()的结果分配给一个Series并按以下方式对其进行过滤:

count = df_1['neighbourhood'].value_counts()
ax = count[count > 2000].plot(kind='bar', figsize=(14,8), title="Neighbourhood that showed")
ax.set_xlabel("neighboorhood") 
ax.set_ylabel("Frequency")