0

I have a CSV file of weather data.

I have the file indexed by date (e.g., the date of the reading).

One of my columns is 'Humidity' and contains humidity data.

I wish to use the .plot function but I wish to limit the data set to between two dates.

To discriminate by time I used this to view my rows,

london[london.loc[datetime(2021,3,1) : datetime(2021,5,31)]]

With london being;

london = read_csv('London_2021.csv')

My question is how can I modify this london['Mean Humidity'].plot(grid=True, figsize=(10,5))

To only display the data between the two dates?

  • you can use `.set_xlim()` and `.set_ylim()` to try to solve this problem please refer to this https://stackoverflow.com/a/31500017/15042684 – Thierno Amadou Sow Apr 03 '22 at 15:57

1 Answers1

0

What about

london[london.loc[start_date : end_date]]['Mean Humidity'].plot(grid=True, figsize=(10,5))
  • When I try `london[london.loc[datetime(2021,3,1) : datetime(2021,5,31)]]['Mean Humidity'].plot(grid=True, figsize=(10,5))` I get a large error which ends with "ValueError: Boolean array expected for the condition, not object" – alexisalexagius Apr 03 '22 at 16:28