请考虑我的系列如下:第一列是article_id,第二列是频率计数.
article_id
1 39
2 49
3 187
4 159
5 158
...
16947 14
16948 7
16976 2
16977 1
16978 1
16980 1
Name: article_id, dtype: int64
Run Code Online (Sandbox Code Playgroud)
我使用以下命令从数据帧中获取此系列:
logs.loc[logs['article_id'] <= 17029].groupby('article_id')['article_id'].count()
Run Code Online (Sandbox Code Playgroud)
logs是这里的数据框,article_id是其中的一列.
如何绘制条形图(使用Matlplotlib),使得article_id位于X轴上,频率计数位于Y轴上?
我的本能是使用.tolist()将其转换为列表但不保留article_id.
var category = "a()";
if(category.charAt(0) == /^[a-zA-Z]+$/){
/*This part doesn't gets executed*/
/*What is the problem with the if condition?*/
}
Run Code Online (Sandbox Code Playgroud)