如何为 df 的每一行绘制一个箱线图?
How can I make a boxplot for each row of df?
我有一些数据,看起来像:
df = pd.DataFrame({'in1' : [100, 150, 110, 180, 125],
'in2' : [200, 210, 125, 125, 293],
'in3' : [50, 35, 200, 100, 180]
'a' : [c, d, e, f,g]})
我如何制作每行 in1 到 in3 的箱线图?
只需输入:
df.T.boxplot()
pandas.DataFrame.boxplot
-方法为每一列创建一个框。您可以使用 pandas.DataFrame.T
方法来解决此问题,该方法转置数据框(即,行变为列,反之亦然)。
我有一些数据,看起来像:
df = pd.DataFrame({'in1' : [100, 150, 110, 180, 125],
'in2' : [200, 210, 125, 125, 293],
'in3' : [50, 35, 200, 100, 180]
'a' : [c, d, e, f,g]})
我如何制作每行 in1 到 in3 的箱线图?
只需输入:
df.T.boxplot()
pandas.DataFrame.boxplot
-方法为每一列创建一个框。您可以使用 pandas.DataFrame.T
方法来解决此问题,该方法转置数据框(即,行变为列,反之亦然)。