Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors are not properly raised when df = True #10

Open
dhhagan opened this issue Apr 21, 2016 · 2 comments
Open

Errors are not properly raised when df = True #10

dhhagan opened this issue Apr 21, 2016 · 2 comments

Comments

@dhhagan
Copy link
Owner

dhhagan commented Apr 21, 2016

screen shot 2016-04-21 at 2 23 38 pm

@stijnvanhoey
Copy link
Contributor

stijnvanhoey commented Jun 21, 2019

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 empty DataFrame when no results are returned? This would at least provide be more informative than the current error.

@dhhagan
Copy link
Owner Author

dhhagan commented Jun 21, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants