diff --git a/fedelemflowlist/globals.py b/fedelemflowlist/globals.py index 3bc04cc..8045475 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 b461586..ce75c89 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)