数据框显示每天的箱线图

Dataframe show a boxplot for each day

我得到了一个 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()

输出:

Objective: 我想从我的 df 中获取每一天的箱线图。

解决方法:

找到了类似的方法,但不幸的是它对我没有进一步的帮助Time-series boxplot in 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')