abhijithneilabraham / tableQA

AI Tool for querying natural language on tabular data.
GNU General Public License v3.0
295 stars 47 forks source link

Error when running colab #72

Open Tizzzzy opened 8 months ago

Tizzzzy commented 8 months ago

I am running the colab code in local using python 3.8.18, and it seems like I have successfully downloaded all the package, but when I run "agent.query_db("how many deaths of age below 40 had stomach cancer?")", it shows this error. Strangely, I can run this line "agent.get_query("how many deaths of age below 40 had stomach cancer?")"

TypeError Traceback (most recent call last) c:\Users\super\OneDrive\Desktop\research\tableQA.ipynb Cell 5 line 1 ----> 1 agent.query_db("how many deaths of age below 40 had stomach cancer?")

File c:\Users\super\anaconda3\envs\nextgpt\lib\site-packages\tableqa\agent.py:72, in Agent.query_db(self, question, verbose, chart, size) 70 database = Database(self.data_dir, self.schema_dir) 71 create_db = getattr(database, self.db_type) ---> 72 engine = create_db(question) 73 answer = engine.execute(query).fetchall() 74 if chart is not None:

File c:\Users\super\anaconda3\envs\nextgpt\lib\site-packages\tableqa\database.py:26, in Database.sqlite(self, question) 24 data_frame=self.data_process.get_dataframe(csv).astype(str) 25 schema=self.data_process.get_schema_for_csv(csv)
---> 26 data_frame = data_frame.fillna(data_frame.mean()) 27 sql_schema = {} 28 for col in schema['columns']:

File c:\Users\super\anaconda3\envs\nextgpt\lib\site-packages\pandas\core\generic.py:11556, in NDFrame._add_numeric_operations..mean(self, axis, skipna, numeric_only, kwargs) 11539 @doc( 11540 _num_doc, 11541 desc="Return the mean of the values over the requested axis.", (...) 11554 kwargs, ... 46 def _sum(a, axis=None, dtype=None, out=None, keepdims=False, 47 initial=_NoValue, where=True): ---> 48 return umr_sum(a, axis, dtype, out, keepdims, initial, where)

TypeError: can only concatenate str (not "int") to str

RomanRutka commented 4 months ago

I have the same issue, no matter what question I test on agent.query_db(). Any idea how to make it work ? No problem with running agent.get_query(), though (except for some questionable results...)