Skip to content

test_forecast failures with pandas 1.0.0 #877

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

Closed
cwhanse opened this issue Feb 3, 2020 · 3 comments · Fixed by #879
Closed

test_forecast failures with pandas 1.0.0 #877

cwhanse opened this issue Feb 3, 2020 · 3 comments · Fixed by #879

Comments

@cwhanse
Copy link
Member

cwhanse commented Feb 3, 2020

Pandas has released v1.0.0. With pandas 1.0.0, test_forecast.test_datetime fails, as #872 shows in the test log. It is not clear if the test itself is the problem: these lines do not set a timezone.

    start = datetime.now()
    end = start + timedelta(days=1)

Should start and end be timezone-aware? The intent of the test is not clear to me.

To Reproduce
Steps to reproduce the behavior:

  1. Install pandas 1.0.0
import pandas as pd
from datetime import datetime, timedelta
from pvlib.forecast import NAM

_latitude = 32.2
_longitude = -110.9
_tz = 'US/Arizona'
_start = pd.Timestamp.now(tz=_tz)
_end = _start + pd.Timedelta(days=1)

amodel = NAM()
start = datetime.now()
end = start + timedelta(days=1)
try:
    amodel.get_processed_data(_latitude, _longitude, start, end)
    print("Success with {}".format(pd.__version__))
except:
    print("Failed with {}".format(pd.__version__))

Now run with pandas < 1.0.0 (e.g., 0.22.0)

@wholmgren
Copy link
Member

The test ensures that the function works if you use a python datetime object instead of pandas datetime object. We should check that start/end are localized and, if not, raise TypeError before issuing the query.

@cwhanse
Copy link
Member Author

cwhanse commented Feb 3, 2020

Want to correct this in conjunction with #878? Or I can do it. The test failures will repeat for every PR unless we pin pandas <= 1.0.0.

@wholmgren
Copy link
Member

Yes, I should have said I'll provide a fix as soon as I get out of conda hell. Apparently I should not have run pip install pandas -U in an environment with conda-provided numpy/netcdf/hdf5. Yay python packaging.

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

Successfully merging a pull request may close this issue.

2 participants