edgi-govdata-archiving / ECHO-Cross-Program

Jupyter Notebooks for ECHO that use data from multiple EPA programs
https://colab.research.google.com/github/edgi-govdata-archiving/ECHO-Cross-Program/blob/master/ECHO-Cross-Programs.ipynb
GNU General Public License v3.0
8 stars 5 forks source link

Error handling for NA #136

Open Frijol opened 2 years ago

Frijol commented 2 years ago

We need graceful error handling for different types of null value that may be returned, in this case NA in cell 5 of the Cross-Programs notebook.

Notebook: https://colab.research.google.com/github/edgi-govdata-archiving/ECHO-Cross-Program/blob/main/ECHO-Cross-Programs.ipynb#scrollTo=tGG4dLXuaRLN

To reproduce: County > WA > Snohomish > run cell 5

select * from "ECHO_EXPORTER" where "FAC_STATE" = 'WA' and "FAC_COUNTY" in ('SNOHOMISH') and "FAC_ACTIVE_FLAG" = 'Y'
http://portal.gss.stonybrook.edu/echoepa/?query=select+%2A+from+%22ECHO_EXPORTER%22+where+%22FAC_STATE%22+%3D+%27WA%27+and+%22FAC_COUNTY%22+in+%28%27SNOHOMISH%27%29+and+%22FAC_ACTIVE_FLAG%22+%3D+%27Y%27&pg
<matplotlib.axes._subplots.AxesSubplot at 0x7f5a1c1fd9d0>
<matplotlib.axes._subplots.AxesSubplot at 0x7f5a1b981290>
TypeError: boolean value of NA is ambiguous
None
Error in callback <function install_repl_displayhook.<locals>.post_execute at 0x7f5a3167a830> (for post_execute):
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/matplotlib/pyplot.py in post_execute()
    107             def post_execute():
    108                 if matplotlib.is_interactive():
--> 109                     draw_all()
    110 
    111             # IPython >= 2

13 frames
/usr/local/lib/python3.7/dist-packages/matplotlib/text.py in set_text(self, s)
   1163         if s is None:
   1164             s = ''
-> 1165         if s != self._text:
   1166             self._text = str(s)
   1167             self.stale = True

pandas/_libs/missing.pyx in pandas._libs.missing.NAType.__bool__()

TypeError: boolean value of NA is ambiguous

Potentially related: #133