Skip to content

Commit

Permalink
resolve future warnings, #162 #166
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed Dec 2, 2024
1 parent 0e3c422 commit 975abe3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stewicombo/overlaphandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def remove_flow_overlap(df, flow_cpst, flows_cntb, cmpt='air', SCC=False):
df_cf = (df.query('SRS_ID in @flows_cntb and '
'_CompartmentPrimary == @cmpt')
.groupby(cols_agg, as_index=False)
.agg({'FlowAmount': sum})
.agg({'FlowAmount': 'sum'})
.assign(SRS_ID=flow_cpst)
.rename(columns={'FlowAmount': 'ContributingAmount'}))
# then remove contributing flow totals from composite flow
Expand Down Expand Up @@ -119,8 +119,8 @@ def aggregate_and_remove_overlap(df):
# functions by column for intra-inventory aggregation
funcs_agg = {
'FacilityID': '_'.join, # or `set` or `'unique'` to get unique set of vals
'FlowAmount': sum,
'DataReliability': sum, # sums FlowAmount-weighted elements
'FlowAmount': 'sum',
'DataReliability': 'sum', # sums FlowAmount-weighted elements
'FlowName': 'first', # get the first element in .agg
}
# cols to define unique flows WITHIN inventories; using more grouping cols,
Expand All @@ -147,7 +147,7 @@ def aggregate_and_remove_overlap(df):

# then drop cross-inventory dups by keeping entries w/ min _SourcePref
df_dup['_SourcePrefMin'] = (df_dup.groupby(cols_inter)['_SourcePref']
.transform(min))
.transform('min'))
df_dup = df_dup.query('_SourcePref == _SourcePrefMin')

log.debug('Reincorporating rows with NaN FRS_ID or SRS_ID')
Expand Down

0 comments on commit 975abe3

Please sign in to comment.