Skip to content

Commit

Permalink
fix to pandas deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Feb 26, 2024
1 parent bec2f7d commit 737b873
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions taxcalc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def stat_dataframe(gdf):
dframe = add_income_table_row_variable(vdf, income_measure,
SOI_AGI_BINS)
# construct grouped DataFrame
gdf = dframe.groupby('table_row', as_index=False)
gdf = dframe.groupby('table_row', observed=False, as_index=False)
dist_table = stat_dataframe(gdf)
del dframe['table_row']
# compute sum row
Expand Down Expand Up @@ -901,7 +901,7 @@ def mtr_graph_data(vdf, year,
weight_by_income_measure=dollar_weighting
)
# split dfx into groups specified by 'table_row' column
gdfx = dfx.groupby('table_row', as_index=False)
gdfx = dfx.groupby('table_row', observed=False, as_index=False)
# apply the weighting_function to percentile-grouped mtr values
mtr1_series = gdfx.apply(weighting_function, 'mtr1').values[:, 1]
mtr2_series = gdfx.apply(weighting_function, 'mtr2').values[:, 1]
Expand Down Expand Up @@ -1018,7 +1018,7 @@ def atr_graph_data(vdf, year,
include = [0] * num_bins_with_nonpos + [1] * (100 - num_bins_with_nonpos)
included = np.array(include, dtype=bool)
# split dfx into groups specified by 'table_row' column
gdfx = dfx.groupby('table_row', as_index=False)
gdfx = dfx.groupby('table_row', observed=False, as_index=False)
# apply weighted_mean function to percentile-grouped values
avginc_series = gdfx.apply(weighted_mean, 'expanded_income').values[:, 1]
avgtax1_series = gdfx.apply(weighted_mean, 'tax1').values[:, 1]
Expand Down Expand Up @@ -1192,7 +1192,7 @@ def pch_graph_data(vdf, year, pop_quantiles=False):
include = [0] * num_bins_with_nonpos + [1] * (100 - num_bins_with_nonpos)
included = np.array(include, dtype=bool)
# split dfx into groups specified by 'table_row' column
gdfx = dfx.groupby('table_row', as_index=False)
gdfx = dfx.groupby('table_row', observed=False, as_index=False)
# apply weighted_mean function to percentile-grouped values
avginc_series = gdfx.apply(weighted_mean, 'expanded_income').values[:, 1]
change_series = gdfx.apply(weighted_mean, 'chg_aftinc').values[:, 1]
Expand Down

0 comments on commit 737b873

Please sign in to comment.