From 60dde4412979e67f44c707274dfc83118ca13015 Mon Sep 17 00:00:00 2001 From: Jeff Minucci Date: Thu, 25 Jan 2024 19:23:15 +0000 Subject: [PATCH] update append to concat for pandas upgrade --- dsstox_rest/batch_query.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsstox_rest/batch_query.py b/dsstox_rest/batch_query.py index 5bd6606..1eb1d7f 100644 --- a/dsstox_rest/batch_query.py +++ b/dsstox_rest/batch_query.py @@ -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)) @@ -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]) @@ -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})