我有一个看起来像这样的数据框:
print(apple_dataframe.head())
Date Open High ... Adj Close Volume Percent_change
0 1999-12-31 3.604911 3.674107 ... 3.204494 40952800 NaN
1 2000-01-03 3.745536 4.017857 ... 3.488905 133949200 0.088754
2 2000-01-04 3.866071 3.950893 ... 3.194754 128094400 -0.084311
3 2000-01-05 3.705357 3.948661 ... 3.241507 194580400 0.014634
4 2000-01-06 3.790179 3.821429 ... 2.960991 191993200 -0.086539
[5 rows x 8 columns]
我得到n个最大值,最小值使用:
print(asset.nlargest(10, 'Percent_change')[['Date','Percent_change']])
问题是,我怎样才能获得每年或每季度,每月或每周等的n个最大值/最小值?