我试图分析一组数据集。但是,我找不到有效展示的方法。我想也许groupby()
可以解决它,但我打算一次显示所有表格,我不知道应该如何说明它。我的另一个解决方案是在比较中显示每一列;第一,第二,然后第三。这是我主要想要实现的,例如:
Mean Std Max Min
First_Result_Set
Second_Result_Set
Third_Result_Set
这是我的另一个解决方案(可能不好):
Mean Std Max Min
First_Result_Set_first_column
Second_Result_Set_first_column
Third_Result_Set_first_column
任何建议或解决方案都会有所帮助。代码:
def analyse_data(self, np_array, raw=45, column=3):
df = pd.DataFrame(np_array.reshape(raw, column),
columns=("Time", "Random Score", "AI Score"))
data_result = df.describe()
print(data_result)
return data_result
analyse_cache_ab_classes_depth_5 = file.analyse_data(cache_ab_classes_depth_5)
analyse_cache_ab_classes_depth_4 = file.analyse_data(cache_ab_classes_depth_4)
analyse_cache_ab_classes_depth_3 = file.analyse_data(cache_ab_classes_depth_3)
输出:
Time Random Score AI Score
count 45.000000 45.000000 45.000000
mean 1.054444 2.355556 12.488889
std 0.423377 2.496867 7.225656
min 0.400000 0.000000 0.000000
25% 0.850000 0.000000 6.000000
50% 0.960000 2.000000 14.000000
75% 1.180000 4.000000 16.000000
max 2.620000 8.000000 28.000000
Time Random Score AI Score
count 45.000000 45.000000 45.000000
mean 2.021333 5.644444 35.288889
std 0.889095 4.270169 12.764692
min 0.780000 0.000000 12.000000
25% 1.310000 2.000000 28.000000
50% 1.780000 4.000000 34.000000
75% 2.590000 8.000000 42.000000
max 4.220000 18.000000 76.000000
Time Random Score AI Score
count 45.000000 45.000000 45.000000
mean 0.207333 1.822222 15.333333
std 0.077295 2.124413 6.993503
min 0.110000 0.000000 4.000000
25% 0.150000 0.000000 10.000000
50% 0.180000 2.000000 16.000000
75% 0.250000 2.000000 20.000000
max 0.380000 10.000000 30.000000