Skip to content

Commit

Permalink
update append to concat for pandas upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyMinucci authored and alexchao32 committed Jan 25, 2024
1 parent 496554c commit 60dde44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dsstox_rest/batch_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def mass_search(self, query, accuracy, dbconn): # Note - accuracy comes in as p
assay_count_active || '/' || assay_count_total as "TOXCAST_NUMBER_OF_ASSAYS/TOTAL"
FROM ms1_batch_search
where msr_monoisotopic_mass BETWEEN """ + str(min_mass) + """ AND """ + str(max_mass) + """;"""
results = results.append(pd.read_sql(sql, dbconn))
results = pd.concat([results, pd.read_sql(sql, dbconn)])
logger.info("=========== Search complete ===========")
results['MASS_DIFFERENCE'] = abs(results['INPUT'].astype(float) -
results['MONOISOTOPIC_MASS_INDIVIDUAL_COMPONENT'].astype(float))
Expand All @@ -101,7 +101,7 @@ def formula_search(self, query, dbconn):
assay_count_active || '/' || assay_count_total as "TOXCAST_NUMBER_OF_ASSAYS/TOTAL"
FROM ms1_batch_search
where msr_mol_formula = '""" + formulaquery + """';"""
results = results.append(pd.read_sql(sql, dbconn))
results = pd.concat([results,pd.read_sql(sql, dbconn)])
logger.info("=========== Search complete ===========")
results['FOUND_BY'] = 'Exact Formula'
results = results.sort_values(by=['INPUT', 'DATA_SOURCES'], ascending=[True, False])
Expand All @@ -119,7 +119,7 @@ def get(self):
password=pw,
database=dbname)
sql = """SELECT DISTINCT msr_mol_formula AS "MS-READY MOLECULAR FORMULA" FROM ms1_batch_search;"""
results = results.append(pd.read_sql(sql, dbconn))
results = pd.concat([results,pd.read_sql(sql, dbconn)])
results_db_dict = results.to_dict(orient='split')
del results_db_dict['index']
return jsonify({'results': results_db_dict})

0 comments on commit 60dde44

Please sign in to comment.