From d9136395821288dad1bbfade234a96016f0017b2 Mon Sep 17 00:00:00 2001 From: okiner-3 Date: Fri, 19 Jun 2026 23:21:31 +0900 Subject: [PATCH] fix(docs): cast strata to str before replace in Oregon tutorial numhh_list is a categorical column, so calling .replace() to map values to a category that does not exist raises a type error. Convert to str before .replace() to avoid this. --- docs/source/tutorials/oregon.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/tutorials/oregon.rst b/docs/source/tutorials/oregon.rst index 84787bf..0f17afe 100644 --- a/docs/source/tutorials/oregon.rst +++ b/docs/source/tutorials/oregon.rst @@ -80,7 +80,7 @@ Next, we prepare the data for the DTE analysis. This involves creating treatment # Create strata based on household size df.rename(columns={'numhh_list': 'strata'}, inplace=True) - df['strata'] = df['strata'].replace({ + df['strata'] = df['strata'].astype(str).replace({ 'signed self up + 1 additional person': 'signed self up + others', 'signed self up + 2 additional people': 'signed self up + others' })