熊猫数据透视表:
Date 0.0.1 0.0.2 0.0.3 Count
5/11 4 3 4 11
6/11 0 2 5 18
7/11 5 1 3 27
我需要在数据透视表中创建Count列,该列将按行对所有值进行计数,对于下一行,将对所有行进行加法运算。
下面是我的数据透视表代码。我想如上所述添加Count列
download_dict['Release'] = release_version
download_dict['Date'] = date
download_dict['Count'] = count
data = pd.DataFrame(download_dict)
pivoted = data.pivot(index='Date', columns='Release', values='Count').reset_index()
So far my pivot table looks like this,
Date 0.0.1 0.0.2 0.0.3
5/11 4 3 4
6/11 0 2 5
7/11 5 1 3