You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(gain_loss): 'Boolean Series key will be reindexed' warnings when df has rows outside p1/p2 #588
What:GainLoss emits six UserWarning: Boolean Series key will be reindexed to match DataFrame index. whenever df has rows that are in neither period. That is the normal case when the data covers more than the two periods being compared. The results are correct, so the warnings are only noise.
Where (main @ c5f4b2a): gain_loss.py:172 subsets df to p1_index | p2_index. L179-195 then index that subset with the original full-length masks, so pandas reindexes each one.
gain_loss.py:179: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
df[focus_group_index & p1_index].groupby(grp_cols, observed=False)[value_col].agg(agg_func),
... (same at lines 180, 181, 191, 192, 193)
Expected: no warnings. For example, align the masks to the subset first (mask.loc[df.index]), or compute the group/period masks before subsetting.
Activity