Skip to content

Key error for some stations #5

Description

@skfrost01

There is a good chance this is a user error, but I am running into the following error, specifically when pulling GHCND and PRCP data. If I follow the example and generate a response, there appears to be data, but using to_dataframe() throws the following error for some stations:

File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-15-7a2ac4d974af>", line 1, in <module> response.to_dataframe() File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/pyncei/bot.py", line 1068, in to_dataframe df = pd.DataFrame(self.values()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/pandas/core/frame.py", line 832, in __init__ data = list(data) ^^^^^^^^^^ File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/pyncei/bot.py", line 1010, in values yield {k: val[k] for k in self.key_order if k in keys} ~~~^^^ KeyError: 'station'

Is there anything I can do to avoid this or check for this issue before running to_dataframe() to avoid erroring out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions