Skip to content

Commit 7a4a7cd

Browse files
committed
fix bug with duplicate columns
1 parent 2886a2b commit 7a4a7cd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/rxn_insight/database.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def create_database_from_df(
2727
yield_column: str = "YIELD",
2828
ref_column: str = "REF"
2929
) -> pd.DataFrame:
30-
all_cols = [solvent_column, reagent_column, catalyst_column, yield_column, ref_column]
30+
all_cols = ["SOLVENT", "REAGENT", "CATALYST", "YIELD", "REF"]
3131
df_protocol = df.rename(columns={reaction_column: "REACTION",
3232
solvent_column: "SOLVENT",
3333
reagent_column: "REAGENT",
@@ -36,7 +36,8 @@ def create_database_from_df(
3636
ref_column: "REF"})
3737
for col in all_cols:
3838
if col not in df_protocol.keys():
39-
df_protocol[col] = ""
39+
df_protocol[col] = "not-reported"
40+
4041
df, skipped_reactions = analyze_reactions(df_protocol)
4142
self.df = df
4243
self.skipped_reactions = skipped_reactions
@@ -56,7 +57,7 @@ def create_database_from_csv(
5657
ref_column: str = "REF"
5758
) -> pd.DataFrame:
5859
df_csv = pd.read_csv(fname, index_col=None)
59-
all_cols = [solvent_column, reagent_column, catalyst_column, yield_column, ref_column]
60+
all_cols = ["SOLVENT", "REAGENT", "CATALYST", "YIELD", "REF"]
6061
df_protocol = df_csv.rename(columns={reaction_column: "REACTION",
6162
solvent_column: "SOLVENT",
6263
reagent_column: "REAGENT",
@@ -65,7 +66,8 @@ def create_database_from_csv(
6566
ref_column: "REF"})
6667
for col in all_cols:
6768
if col not in df_protocol.keys():
68-
df_protocol[col] = ""
69+
df_protocol[col] = "not-reported"
70+
6971
df, skipped_reactions = analyze_reactions(df_protocol)
7072
self.df = df
7173
self.skipped_reactions = skipped_reactions

0 commit comments

Comments
 (0)