内容
隐藏
问题:熊猫重新采样文档
因此,我完全理解如何使用resample,但是文档在解释这些选项方面做得不好。
因此,resample
除了以下两个以外,函数中的大多数选项都非常简单:
- rule:表示目标转换的偏移量字符串或对象
- 方式:字符串,下采样或重新采样的方法,默认为“均值”
因此,通过查看我在网上找到的尽可能多的示例,我可以看到规则可以'D'
在一天,'xMin'
几分钟,'xL'
几毫秒内完成,但这就是我所能找到的全部。
如何我看到的情况如下:'first'
,np.max
,'last'
,'mean'
,和'n1n2n3n4...nx'
其中nx为每列索引的第一个字母。
因此,我在文档中缺少的某个地方显示了pandas.resample
规则的每个选项以及如何输入?如果是,在哪里,因为我找不到它。如果没有,那么他们有什么选择?
回答 0
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, BY business year end frequency
AS, YS year start frequency
BAS, BYS business year start frequency
BH business hour frequency
H hourly frequency
T, min minutely frequency
S secondly frequency
L, ms milliseconds
U, us microseconds
N nanoseconds
请参阅时间序列文档。它包括偏移量列表(和“锚定”偏移量),以及有关重采样的部分。
请注意,没有所有不同how
选项的列表,因为它可以是任何NumPy数组函数,并且可以通过nameby传递通过groupby分派可用的任何函数how
。
回答 1
不仅限于此,但您可能正在寻找以下列表:
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