To auto-extract the minimum and maximum values of a date in Pandas

Asked 5 months ago, Updated 5 months ago, 12 views

For the time series temperature data shown in the table below, 2000, 2001... and the average value for each year are calculated.

If you know the start-end date,

df ['2001-01-05':'2001-12-28'].mean()

I think it would be better to specify the value directly, but instead of checking the data one by one, how should I program it if I want to determine start/

I thought I would use df.min(), but I would extract the minimum value of the entire data instead of each year.

date(index) temperature
2000-01-04 -1℃
2000-01-05 0℃
2000-12-27 8℃
2001-01-05 2℃
2001-01-06 3℃
2001-12-28 -1℃

python python3 pandas

2022-09-30 11:04

1 Answers


What about now?


Should I use the maximum and minimum indexes differently depending on the purpose?

2022-09-30 11:04

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.