Skip to content

Commit

Permalink
Fix because of how factory is defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
PennyWieser committed Oct 13, 2024
1 parent 9601346 commit 93d29e2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Thermobar/aztecloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,18 @@ def extract_silicate_standard_data(df_final, PersonName, StdName, AnalysisDate,


# Display the new DataFrame
df_filtered2=df_standard.loc[df_standard['SampleID'].str.contains(StdString)]
#df_filtered2=df_standard.loc[df_standard['SampleID'].str.contains(StdString)]
df_filtered2 = df_standard.loc[df_standard['SampleID'].fillna('').str.contains(StdString, na=False)]

# Fill 'Standard Name' columns with 'Factory' if empty
standard_name_cols = [col for col in df_standard.columns if col.startswith('Standard Name')]
df_filtered2.loc[:, standard_name_cols] = df_filtered2.loc[:, standard_name_cols].fillna('Factory')

# Fill 'Standardization Date' columns with 'Feb 2024' if empty
# Fill 'Standardization Date' columns with 'Factory' if empty
standard_date_cols = [col for col in df_standard.columns if col.startswith('Standardization Date')]
df_filtered2.loc[:, standard_date_cols] = df_filtered2.loc[:, standard_date_cols].fillna('Feb 2024')

# Use .copy() to ensure we're working with a copy to avoid chained assignment issues
df_filtered2 = df_filtered2.copy()

# Fill only the 'Standardization Date' columns with 'Factory' where values are empty (NaN)
df_filtered2[standard_date_cols] = df_filtered2[standard_date_cols].fillna('Factory')
display(df_filtered2.head())

return df_filtered2
Expand Down

0 comments on commit 93d29e2

Please sign in to comment.