From acff0f1b7b885581122a25f03b172e6b2ec253fc Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Sun, 22 Nov 2026 21:21:52 +1100 Subject: [PATCH] inflation_history, fitting_distributions: state what pandas now warns about Two cells printed a pandas warning into their output: - inflation_history: pd.concat of the sheets, which all have a DatetimeIndex, sorts the joined index by default, which pandas 3 deprecates (Pandas4Warning: "Sorting by default when concatenating all DatetimeIndex is deprecated"). `sort=True` keeps today's sorted result. - fitting_distributions: `times` is in UTC, and converting it to monthly periods drops the time zone, with a UserWarning. Dropping it first with `tz_localize(None)` gives the same months, without the warning. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL --- lectures/fitting_distributions.md | 2 +- lectures/inflation_history.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/fitting_distributions.md b/lectures/fitting_distributions.md index 0bf51230..d6f71e50 100644 --- a/lectures/fitting_distributions.md +++ b/lectures/fitting_distributions.md @@ -816,7 +816,7 @@ with long quiet periods in between. We can see this directly by counting events per month. ```{code-cell} ipython3 -monthly = times.dt.to_period('M').value_counts().sort_index() +monthly = times.dt.tz_localize(None).dt.to_period('M').value_counts().sort_index() monthly.mean(), monthly.var() ``` diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 4516954d..a7417474 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -384,7 +384,7 @@ for i in range(4): for ind, row in zip(indices, rows)] sheet_list = [process_df(df) for df in sheet_list] - df_list.append(pd.concat(sheet_list, axis=1)) + df_list.append(pd.concat(sheet_list, axis=1, sort=True)) df_aus, df_hun, df_pol, df_deu = df_list ```