ElectionDataAnalysis / electiondata

Tools for consolidation and analysis of raw election results from the most reliable sources -- the election agencies themselves.
Other
20 stars 5 forks source link

Ugly fail when requesting bar chart if no data in db #232

Closed sfsinger19103 closed 3 years ago

sfsinger19103 commented 4 years ago
an = ea.Analyzer()
b = an.bar("2018 General","Georgia","congressional")

called on a database without any Georgia results yielded:

Traceback (most recent call last):
  File "/Users/singer3/PycharmProjects/election_data_analysis/venv/lib/python3.8/site-packages/pandas/core/generic.py", line 5143, in __setattr__
    return object.__setattr__(self, name, value)
  File "pandas/_libs/properties.pyx", line 66, in pandas._libs.properties.AxisProperty.__set__
  File "/Users/singer3/PycharmProjects/election_data_analysis/venv/lib/python3.8/site-packages/pandas/core/generic.py", line 564, in _set_axis
    self._mgr.set_axis(axis, labels)
  File "/Users/singer3/PycharmProjects/election_data_analysis/venv/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 226, in set_axis
    raise ValueError(
ValueError: Length mismatch: Expected axis has 0 elements, new values have 20 elements
python-BaseException
sfsinger19103 commented 3 years ago

fixed