【问题标题】:Dataframe show a boxplot for each day数据框显示每天的箱线图
【发布时间】:2021-11-12 15:02:04
【问题描述】:

我有一个 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 中获取每天的箱线图。

解决方法:

找到了类似的方法,但不幸的是它对我没有进一步的帮助Time-series boxplot in pandas

最后一个答案也适用于时间戳,但在索引中。如何将其应用于列?

【问题讨论】:

    标签: pandas dataframe group-by boxplot


    【解决方案1】:

    应该适用于这个特定问题的示例:

    # 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')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-01
      • 1970-01-01
      • 2016-10-30
      • 2017-03-20
      • 1970-01-01
      • 2022-11-17
      • 2014-11-05
      • 1970-01-01
      相关资源
      最近更新 更多