我有爱尔兰的 covid 测试数据集。五月的数据刚刚停止。
为了延续这一趋势,我采用了上一个稳定时期的平均周一至周日。所以我有7个不同的平均值。
现在我想编辑数据集以从索引为“47545”的行中按顺序插入这些值。
我没有收到任何错误,也不会更改数据集。
ireland_df3 = ireland_df.copy()
ireland_df3[ireland_df3.reset_index().index % 7 == 47545]['new_tests_per_thousand'] = df1_mean
ireland_df3[ireland_df3.reset_index().index % 7 == 47546]['new_tests_per_thousand'] = df2_mean
ireland_df3[ireland_df3.reset_index().index % 7 == 47547]['new_tests_per_thousand'] = df3_mean
ireland_df3[ireland_df3.reset_index().index % 7 == 47548]['new_tests_per_thousand'] = df4_mean
ireland_df3[ireland_df3.reset_index().index % 7 == 47549]['new_tests_per_thousand'] = df5_mean
ireland_df3[ireland_df3.reset_index().index % 7 == 47550]['new_tests_per_thousand'] = df6_mean
ireland_df3[ireland_df3.reset_index().index % 7 == 47551]['new_tests_per_thousand'] = df7_mean
有任何想法吗?
