如何为 df 的每一行制作箱线图?

发布于 2025-01-17 06:49:48 字数 276 浏览 4 评论 0原文

我有一些数据,看起来像:

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 的箱线图?

I have some data, it looks like:

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]})

How can I make a boxplot per row of in1 to in3?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱纠缠 2025-01-24 06:49:48

只需输入以下内容:

df.T.boxplot()

pandas.DataFrame.boxplot 方法为每一列创建一个框。您可以通过使用 pandas.DataFrame.T 方法来解决此问题,该方法会转置数据帧(即,行变为列,反之亦然)。

Simply type this:

df.T.boxplot()

The pandas.DataFrame.boxplot-method creates a box for each column. You can work around this by using the pandas.DataFrame.T-method which transposes the dataframe (i.e., rows become columns and vice versa).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文