Leon-Soil-and-Water / aq-bot

Twitter bot that posts daily air quality repots on the Leon Soil and Water Twitter account
MIT License
0 stars 0 forks source link

Not reporting, even when AirNow is functional #24

Closed shelbygreen closed 2 years ago

shelbygreen commented 2 years ago

what's wrong: Bot didn't post today at 8am or 3pm. Logged into the VM and received this error:

Traceback (most recent call last): File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1625, in pandas._libs.hashtable.Int64HashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1632, in pandas._libs.hashtable.Int64HashTable.get_item KeyError: 0

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "bot.py", line 144, in schedule.run_pending() File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/schedule/init.py", line 780, in run_pending default_scheduler.run_pending() File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/schedule/init.py", line 100, in run_pending self._run_job(job) File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/schedule/init.py", line 172, in _run_job ret = job.run() File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/schedule/init.py", line 661, in run ret = self.job_func() File "bot.py", line 95, in post add_conditions(df) File "bot.py", line 36, in add_conditions dataframe.loc[i, 'status'] = conditions[conditions['category'] == df.loc[i, 'Category']]['status'].loc[0] File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 895, in getitem return self._getitem_axis(maybe_callable, axis=axis) File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 1124, in _getitem_axis return self._get_label(key, axis=axis) File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 1073, in _get_label return self.obj.xs(label, axis=axis) File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/pandas/core/generic.py", line 3739, in xs loc = index.get_loc(key) File "/Users/shelbygreen/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3082, in get_loc raise KeyError(key) from err KeyError: 0

shelbygreen commented 2 years ago

found the issue. there was an issue with the add_conditions data frame. it needed to be reindexed