pandas - 数据框显示每天的箱线图
问题描述
我有一个 DataFrmae(choosen_merged):
ax = choosen_merged.boxplot()
ax.set_title("Boxplot"+" Sensor: "+f"{pick_column}"+" "+f"{df_date}")
#ax.set_xlabel("x_label")
ax.set_ylabel(f"{a_string}")
plt.show()
输出:
目标: 我想从我的 df 中获取每天的箱线图。
解决方法:
找到了类似的方法,但不幸的是,它并不能帮助我在 pandas 中进一步的时间序列箱线图
最后一个答案也适用于时间戳,但在索引中。如何将其应用于列?
解决方案
一个应该适用于这个特定问题的例子:
# Setting up our x-axis, the longtime column has to be of dtype 'datetime'
choosen_merged['days'] = choosen_merged.longtime.dt.day
# Using sb.boxplot, you can also use matplotlib.pyplot.boxplot
import seaborn as sb
sb.boxplot(data=choosen_merged, x='days', y='temperature_ers_lite_1_wermser_0_elsys_0')
推荐阅读
- angular - 如何将一个组件中的变量用于角度的另一个组件
- hyperledger-fabric - 无法使用 Fabric SDK Java 更新通道配置:字段“common.ConfigUpdate.channel_id”包含无效的 UTF-8
- java - 如何创建包含多个 jar 的自定义 pom 依赖项?可能吗?
- python - Google Analytics v4 自定义事件(服务器端)
- ios - Xcode 图像集纵横比
- flutter - 全局变量或 Provider 不允许 Flutter 中的增量
- svg - manim 不会在电影中添加 svg 文本
- http - 无法解析域名
- gradle - 在另一个任务中使用 Gradle 任务功能
- c# - C# 从另一个 Form2 更改 SQL 查询和 Form1 的 DGV