如何为 pandas 重采样提供进度条

How to provide a progress bar for pandas resample

我最近发现了优秀的tqdm package which makes displaying progress bars about everything very easy. It has some integration with pandas as well which provides a progress bar for when using .progress_apply() instead of .apply()

在我当前的项目中,我正在使用 pandas 对一些数据进行重采样,这需要相当长的时间。有什么方法可以获得重采样过程的进度条吗?

这是我想要进度的行:

df_plot_data = changelog_dataframe.groupby(["key","field"]).resample("W").last().fillna(method="ffill")

试试这个:

changelog_dataframe.groupby(["key","field"]).progress_apply(lambda x : x.resample("W").last()).fillna(method="ffill")