因此,我有一个数据框,其中列'Art\u Label'有一个标签,标签上有文章的分类,可能的值是'politica'、'remotes'、'elmundo'、'otros'、'policiales'、'economia'、'editorial'
这是上面的代码
data = pd.read_csv('/filename.csv', sep=',')
data = data.drop('Unnamed: 0', axis=1)
data.columns
Index([u'Date', u'Title', u'Encabezado', u'Art_Label', u'Media'], dtype='object')
import matplotlib.pyplot as plt
%matplotlib inline
df = data['Art_Label']
df2 = df.value_counts()
df2.plot(kind = 'hist', xlim = (0,400))
print df2
我想用每个标签和它的频率创建一个直方图,我用´df2=df.value\u计数(),我希望能够获得直方图上每个值的标签:
这些是我从´df2=df.value\u计数()
politica 332
deportes 323
elmundo 192
otros 191
policiales 137
economia 132
editorial 96
Name: Art_Label, dtype: int64
对你的问题有点困惑。你想要这个数字吗?如果是的话,我想“酒吧”是你想要的。。。你知道吗
enter image description here
相关问题 更多 >
编程相关推荐