pandasresample文件

所以我完全理解如何使用resample ,但是文档并没有很好地解释这些选项。

所以resample函数中的大部分选项都非常简单,除了这两个:

  • 规则:表示目标转换的偏移string或对象
  • 如何:string,用于下采样或重采样的方法,默认为“mean”

所以从我在网上find的很多例子来看,我可以看到规则,你可以做'D'的一天, 'xMin'的几分钟, 'xL'的毫秒,但这是我能find的。

对于我如何看到以下内容: 'first'np.max'last''mean''n1n2n3n4...nx' ,其中nx是每列索引的第一个字母。

那么在文档里有什么地方我缺less显示pandas.resample规则的每个选项以及如何input? 如果是的话,因为我找不到它。 如果不是, 他们有什么select?

 B business day frequency C custom business day frequency (experimental) D calendar day frequency W weekly frequency M month end frequency SM semi-month end frequency (15th and end of month) BM business month end frequency CBM custom business month end frequency MS month start frequency SMS semi-month start frequency (1st and 15th) BMS business month start frequency CBMS custom business month start frequency Q quarter end frequency BQ business quarter endfrequency QS quarter start frequency BQS business quarter start frequency A year end frequency BA business year end frequency AS year start frequency BAS business year start frequency BH business hour frequency H hourly frequency T minutely frequency S secondly frequency L milliseonds U microseconds N nanoseconds 

请参阅时间序列文档 。 它包括偏移量列表(和“锚定”偏移量 ),以及关于重新采样的部分。

请注意,没有列出所有不同的选项,因为它可以是任何NumPy数组函数,并且可以通过groupby调度使用的任何函数都可以传递给名称。

除此之外还有更多,但你可能正在寻找这个列表:

 B business day frequency C custom business day frequency (experimental) D calendar day frequency W weekly frequency M month end frequency BM business month end frequency MS month start frequency BMS business month start frequency Q quarter end frequency BQ business quarter endfrequency QS quarter start frequency BQS business quarter start frequency A year end frequency BA business year end frequency AS year start frequency BAS business year start frequency H hourly frequency T minutely frequency S secondly frequency L milliseconds U microseconds 

资料来源: http : //pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases