From 78dc3a6b86b3dbe03694f414137b3e632a381d5e Mon Sep 17 00:00:00 2001 From: Ben Young Date: Wed, 4 Dec 2024 19:15:46 -0500 Subject: [PATCH] resolve incompatible dtype FutureWarning --- fedelemflowlist/globals.py | 2 +- scripts/build_lcia_mapping.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fedelemflowlist/globals.py b/fedelemflowlist/globals.py index 3bc04cca..80454758 100644 --- a/fedelemflowlist/globals.py +++ b/fedelemflowlist/globals.py @@ -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'] diff --git a/scripts/build_lcia_mapping.py b/scripts/build_lcia_mapping.py index b4615860..ce75c898 100644 --- a/scripts/build_lcia_mapping.py +++ b/scripts/build_lcia_mapping.py @@ -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 @@ -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)