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['2000-01-04':'2000-12-27'].mean()
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℃
df.resample('1Y').mean()
What about now?
pd.Series(df.index).min()
pd.Series(df.index).max()
df.index[0]
df.index[-1]
df.idxmin()
df.idxmax()
Should I use the maximum and minimum indexes differently depending on the purpose?
342 Memory layouts learned in theory don't work out as expected when actually printed as addresses.
353 I have saved several codes written in python to a visual studio file.
356 Unity Virtual Stick Does Not Return to Center When You Release Your Finger
346 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2023 OneMinuteCode. All rights reserved.