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

TypeError: '<=' not supported between instances of 'str' and 'datetime.datetime' #26

Closed
e-hamza opened this issue Apr 6, 2021 · 5 comments · Fixed by #27
Closed

TypeError: '<=' not supported between instances of 'str' and 'datetime.datetime' #26

e-hamza opened this issue Apr 6, 2021 · 5 comments · Fixed by #27
Labels
bug Something isn't working

Comments

@e-hamza
Copy link
Contributor

e-hamza commented Apr 6, 2021

While running this Python example from the official documentation:

# Import Meteostat library and dependencies
from datetime import datetime
import matplotlib.pyplot as plt
from meteostat import Point, Daily

# Set time period
start = datetime(2018, 1, 1)
end = datetime(2018, 12, 31)

# Create Point for Vancouver, BC
vancouver = Point(49.2497, -123.1193, 70)

# Get daily data for 2018
data = Daily(vancouver, start, end)
data = data.fetch()

# Plot line chart including average, minimum and maximum temperature
data.plot(y=['tavg', 'tmin', 'tmax'])
plt.show()

I get the following error:
TypeError: '<=' not supported between instances of 'str' and 'datetime.datetime'

Note: I have all the dependencies installed as requested in the doc. I didn't get this error a few days ago, I just got it today, maybe it's related to the latest version?

@clampr clampr added the bug Something isn't working label Apr 6, 2021
@clampr clampr mentioned this issue Apr 6, 2021
@clampr clampr closed this as completed in #27 Apr 6, 2021
@clampr
Copy link
Member

clampr commented Apr 6, 2021

Seems like the bug was caused by a Pandas update. Please upgrade to version 1.1.2 and let me know if that solves the problem. You should probably delete the ~/.meteostat folder before trying again.

@GangaBisht
Copy link

GangaBisht commented Apr 7, 2021

Hi,

I have updated Pandas package (latest 1.2.3) and still face the same issue. I even uninstalled and reinstalled the meteostat package. Also, I am new to python, can you please let me know where i should look for /.meteostat folder

@clampr
Copy link
Member

clampr commented Apr 7, 2021

Can you try to re-install Meteostat with:

pip install meteostat==1.1.2 -U

By default, the .meteostat folder is located in your home directory (~).

@scmbradley
Copy link

I had this problem and rm -rf ~/.meteostat and pip install -U meteostat fixed this issue.

@GangaBisht
Copy link

Thanks, it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants