Skip to content

Commit

Permalink
Avoid multiple frame.insert warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainipp committed Dec 11, 2024
1 parent 686dd55 commit f86251f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion openfisca_survey_manager/calmar.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,18 @@ def F_prime(x):
if isinstance(val, dict):
dummies_dict = build_dummies_dict(data[entity][var])
k, pop = 0, 0
list_col_to_add = [data[entity]]
for cat, nb in val.items():
cat_varname = var + '_' + str(cat)
data[entity][cat_varname] = dummies_dict[cat]
list_col_to_add.append(pd.Series(dummies_dict[cat], name = cat_varname))
margins_new[cat_varname] = nb
if var not in margins_new_dict:
margins_new_dict[var] = {}
margins_new_dict[var][cat] = nb
pop += nb
k += 1
nj += 1
data[entity] = pd.concat(list_col_to_add, axis = 1)
# Check total popualtion
population = (entity == target_entity) * total_population + (entity != target_entity) * total_population_smaller_entity
if pop != population:
Expand Down

0 comments on commit f86251f

Please sign in to comment.