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

Resampling flight data results in a ValueError #12

Closed
simonrp84 opened this issue Mar 1, 2019 · 5 comments
Closed

Resampling flight data results in a ValueError #12

simonrp84 opened this issue Mar 1, 2019 · 5 comments
Assignees

Comments

@simonrp84
Copy link
Contributor

Hello,
When I try to resample flight data using the built-in method I get a ValueError.
To reproduce:

from traffic.data import opensky
flight = opensky.history("2017-02-05", callsign="EZY158T")
flight2=flight.resample()

Gives this error:

  File "<stdin>", line 1, in <module>
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/traffic/core/flight.py", line 628, in resample
    .resample(rule)
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/core/generic.py", line 6835, in interpolate
    **kwargs)
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 519, in interpolate
    return self.apply('interpolate', **kwargs)
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 395, in apply
    applied = getattr(b, f)(**kwargs)
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/core/internals/blocks.py", line 1845, in interpolate
    limit=limit),
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/core/arrays/datetimelike.py", line 769, in fillna
    value, method = validate_fillna_kwargs(value, method)
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/util/_validators.py", line 348, in validate_fillna_kwargs
    method = clean_fill_method(method)
  File "/network/aopp/apres/users/proud/conda/lib/python3.6/site-packages/pandas/core/missing.py", line 91, in clean_fill_method
    raise ValueError(msg)
ValueError: Invalid fill method. Expecting pad (ffill) or backfill (bfill). Got linear

This is using the latest build of traffic (obtained with: pip install git+https://github.com/xoolive/traffic), Pandas version 0.24.1 and python version 3.6.7.

Any ideas what's happening? I tried to diagnose it but have not had any success.

@xoolive xoolive self-assigned this Mar 1, 2019
@xoolive
Copy link
Owner

xoolive commented Mar 1, 2019

Thank you for the feedback.
I cannot reproduce the issue with my current version of pandas (0.23.4) but will do the upgrade in the coming days.

@simonrp84
Copy link
Contributor Author

No problem.
For what it's worth, I'm running in a conda environment and I know there are some problems when installing pip packages in conda - maybe that happens here.

@xoolive
Copy link
Owner

xoolive commented Mar 1, 2019

Coming close, the problem comes from columns with a tz-aware timestamp. (Linear interpolation works ok if we remove those columns)

I had a similar issue with Flight.query_ehs() on concatenation with previous version of pandas. (https://github.com/xoolive/traffic/blob/master/traffic/core/flight.py#L314)

I will find a workaround...

@xoolive
Copy link
Owner

xoolive commented Mar 1, 2019

Just opened pandas-dev/pandas#25508

@xoolive xoolive closed this as completed in 9b85af8 Mar 1, 2019
@xoolive
Copy link
Owner

xoolive commented Mar 1, 2019

@simonrp84 latest commit fixes your issue

xoolive added a commit that referenced this issue Apr 27, 2019
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