我创建了一个数据框,如图所示:
idx = pd.MultiIndex.from_product([['batch1', 'batch2','batch3', 'batch4', 'batch5'], ['quiz1', 'quiz2']])
cols=['noofpresent', 'lesserthan50', 'between50and60', 'between60and70', 'between70and80', 'greaterthan80']
statdf = pd.DataFrame('-', idx, cols)
statdf
statdf.loc['quiz1', 'noofpresent'] = qdf1.b4ispresent.count()
statdf.loc['quiz2', 'noofpresent'] = qdf2.b4ispresent.count()
statdf.noopresent = qdf1.b4ispresent.count()
statdf.noopresent = qdf2.b4ispresent.count()
statdf
然后我做了一些计算。我现在想分别在“ batch4 ”、“quiz1”和“quiz2”的“noofpresent”列中附加数字“50”和“53”的具体计算。但相反,这发生了......
如何将数据插入正确的位置?
Smart猫小萌
相关分类