@@ -109,6 +109,8 @@ def split_sample_data_dir_state_edit(tmpdir_factory, split_sample_data_dir):
109109 # We do not filter by state for SSA
110110 if dataset_name != DatasetNames .SSA :
111111 # Add a state so we can filter for integration tests
112+ # Make a copy to avoid read-only categorical array error
113+ data = data .copy ()
112114 state_column = [column for column in data .columns if "state" in column ]
113115 data .loc [data .reset_index ().index % 2 == 0 , state_column ] = STATE
114116 data .to_parquet (outdir / data_path .name )
@@ -208,6 +210,8 @@ def noised_sample_data_taxes_1040(config):
208210def sample_data_decennial_census_state_edit ():
209211 data = _load_sample_data (DATASETS .census .name )
210212 # Set half of the entries to the state we'll filter on
213+ # Make a copy to avoid read-only categorical array error
214+ data = data .copy ()
211215 data .loc [data .reset_index ().index % 2 == 0 , DATASETS .census .state_column_name ] = STATE
212216 return data
213217
@@ -216,6 +220,8 @@ def sample_data_decennial_census_state_edit():
216220def sample_data_american_community_survey_state_edit ():
217221 data = _load_sample_data (DATASETS .acs .name )
218222 # Set half of the entries to the state we'll filter on
223+ # Make a copy to avoid read-only categorical array error
224+ data = data .copy ()
219225 data .loc [data .reset_index ().index % 2 == 0 , DATASETS .acs .state_column_name ] = STATE
220226 return data
221227
@@ -224,6 +230,8 @@ def sample_data_american_community_survey_state_edit():
224230def sample_data_current_population_survey_state_edit ():
225231 data = _load_sample_data (DATASETS .cps .name )
226232 # Set half of the entries to the state we'll filter on
233+ # Make a copy to avoid read-only categorical array error
234+ data = data .copy ()
227235 data .loc [data .reset_index ().index % 2 == 0 , DATASETS .cps .state_column_name ] = STATE
228236 return data
229237
@@ -232,6 +240,8 @@ def sample_data_current_population_survey_state_edit():
232240def sample_data_women_infants_and_children_state_edit ():
233241 data = _load_sample_data (DATASETS .wic .name )
234242 # Set half of the entries to the state we'll filter on
243+ # Make a copy to avoid read-only categorical array error
244+ data = data .copy ()
235245 data .loc [data .reset_index ().index % 2 == 0 , DATASETS .wic .state_column_name ] = STATE
236246 return data
237247
@@ -240,6 +250,8 @@ def sample_data_women_infants_and_children_state_edit():
240250def sample_data_taxes_w2_and_1099_state_edit ():
241251 data = _load_sample_data (DATASETS .tax_w2_1099 .name )
242252 # Set half of the entries to the state we'll filter on
253+ # Make a copy to avoid read-only categorical array error
254+ data = data .copy ()
243255 data .loc [
244256 data .reset_index ().index % 2 == 0 , DATASETS .tax_w2_1099 .state_column_name
245257 ] = STATE
0 commit comments