Open dhhagan opened 8 years ago
Similar error when the API is not returning any data, resulting in a KeyError: 'date.local' when using
df=Trueinstead of returning an empty
DataFrame` (see also current test build failure).
For example:
api.measurements(
city='Delhi',
parameter='pm25',
location='Anand Vihar',
limit=5,
df=False)
returns
(200,
{'meta': {'name': 'openaq-api',
'license': 'CC BY 4.0',
'website': 'https://docs.openaq.org/',
'page': 1,
'limit': 5,
'found': 0,
'pages': 0},
'results': []})
Whereas
api.measurements(
city='Delhi',
parameter='pm25',
location='Anand Vihar',
limit=5,
df=True)
in
...
KeyError: 'date.local'
Would it be an option if I try to provide a quick fix in the pandasize
decorator to return an empty DataFrame
when no results are returned? This would at least provide be more informative than the current error.
Yup! That sounds great.
On Fri, Jun 21, 2019 at 9:31 AM Stijn Van Hoey notifications@github.com wrote:
Similar error when the API is not returning any data, resulting in a KeyError: 'date.local' when usingdf=Trueinstead of returning an emptyDataFrame` (see also current test build failure).
For example:
api.measurements( city='Delhi', parameter='pm25', location='Anand Vihar', limit=5, df=False)
returns
(200, {'meta': {'name': 'openaq-api', 'license': 'CC BY 4.0', 'website': 'https://docs.openaq.org/', 'page': 1, 'limit': 5, 'found': 0, 'pages': 0}, 'results': []})
Whereas
api.measurements( city='Delhi', parameter='pm25', location='Anand Vihar', limit=5, df=True)
in
... KeyError: 'date.local'
Would it be an option if I try to provide a quick fix in the
pandasize
decorator to return an emptyDataFrame
when no results are returned? This would at least provide be more informative than the current error.— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhhagan/py-openaq/issues/10?email_source=notifications&email_token=ABBLASE347N55GXBJMIKSNDP3TJZZA5CNFSM4CBTZFN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYIPADA#issuecomment-504426508, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBLASBRH3W5RMRK5EVXKMDP3TJZZANCNFSM4CBTZFNQ .
-- Regards,
David H Hagan PhD Candidate - Atmospheric Physics and Chemistry Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P. 707.227.6695 | E. dhagan@mit.edu | W. https://www.davidhagan.me http://davidhagan.me