Skip to content

Commit 043ad8b

Browse files
authored
fix(docs): cast strata to str before replace in Oregon tutorial (#116)
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.
1 parent 5c85848 commit 043ad8b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/source/tutorials/oregon.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Next, we prepare the data for the DTE analysis. This involves creating treatment
8080
8181
# Create strata based on household size
8282
df.rename(columns={'numhh_list': 'strata'}, inplace=True)
83-
df['strata'] = df['strata'].replace({
83+
df['strata'] = df['strata'].astype(str).replace({
8484
'signed self up + 1 additional person': 'signed self up + others',
8585
'signed self up + 2 additional people': 'signed self up + others'
8686
})

0 commit comments

Comments
 (0)