按周对每日数据进行分组-数据框matplotlib

时间:2020-06-11 11:11:54

标签: python-3.x pandas matplotlib

我有一个数据框,每天有多个行。我已经能够按天分组,因此它每天都在计算一列的值,但是我真的很想每周做同样的事情。以下内容适用于每日数据,我无法每周获取:

df.groupby(['Date','Type']).size().unstack().plot(kind='bar',stacked=False).legend(title='')
plt

1 个答案:

答案 0 :(得分:1)

使用enter image description here

 count = 0
for word in my_list:
    if word.lower().find('item') != -1:
        count +=1

print(count)