我有时隙数据。你知道吗
ds = [ds01, ds02, ds03, ds04, ...]
对于循环中的结果,使用:
nhelp = []
for d in ds:
nhelp.append(d.groupby(list(d)[1]).size().sum) #single column
nhelp
例如,最喜欢的颜色(哪些数据表示为1 2 3。。。(在问卷中) 我得到了:
[<bound method Series.sum of color
1.0 215
2.0 202
3.0 215
4.0 178
dtype: int64>, <bound method Series.sum of color
1.0 252
2.0 244
3.0 241
4.0 133
dtype: int64>, <bound method Series.sum of color
........
dtype: int64>]
现在我要总结所有时间段的颜色,并在一个图表中显示结果。(这里我尝试了pivot、crosstable、loops、-将list转换为array或/和dataframe-sumation和plot失败,也不可能迭代这个变量,但我可以访问值,例如nhelp[1][1])
我认为您需要通过^{} 联接所有数据,然后通过
Index
求和:或列表理解:
相关问题 更多 >
编程相关推荐