Skip to content

Commit

Permalink
resolve incompatible dtype FutureWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed Dec 5, 2024
1 parent 104c50b commit 78dc3a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fedelemflowlist/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def add_conversion_to_mapping(flow_mapping):

# update conversion factor where current conversion is 1 and the updated conversion exists
converted1 = mapping_w_conversion['InverseConversionFactor'].notnull()
converted2 = mapping_w_conversion['ConversionFactor']==1
converted2 = mapping_w_conversion['ConversionFactor']==1.0
mapping_w_conversion['Convert']=converted1 & converted2
mapping_w_conversion.loc[(mapping_w_conversion['Convert']==True),
'ConversionFactor']=mapping_w_conversion['InverseConversionFactor']
Expand Down
8 changes: 4 additions & 4 deletions scripts/build_lcia_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def get_manual_mappings(source, ftype):
lciafmt_w_context_flowable_mappings['SourceListName'] = lcia_name
if 'ConversionFactor' in flowable_mappings:
lciafmt_w_context_flowable_mappings['ConversionFactor'] = \
lciafmt_w_context_flowable_mappings['ConversionFactor'].fillna(1)
lciafmt_w_context_flowable_mappings['ConversionFactor'].fillna(1.0)
else:
lciafmt_w_context_flowable_mappings['ConversionFactor'] = 1
lciafmt_w_context_flowable_mappings['ConversionFactor'] = 1.0
lciafmt_w_context_flowable_mappings['SourceFlowUUID'] = None

# Add conversion factors
Expand All @@ -87,8 +87,8 @@ def get_manual_mappings(source, ftype):
lcia_mappings = add_uuid_to_mapping(lciafmt_w_context_flowable_mappings)

# Sort to maintain mapping file consistency
lcia_mappings.sort_values(by=['SourceFlowName','SourceFlowContext'],
inplace=True, ignore_index=True)
lcia_mappings = lcia_mappings.sort_values(
by=['SourceFlowName','SourceFlowContext'], ignore_index=True)

# Write them to a csv
lcia_mappings.to_csv(flowmappingpath / f'{lcia_name}.csv', index=False)

0 comments on commit 78dc3a6

Please sign in to comment.