pandas 重新采样文档 [英] pandas resample documentation

查看:24
本文介绍了 pandas 重新采样文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

So I completely understand how to use resample, but the documentation does not do a good job explaining the options.

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

So most options in the resample function are pretty straight forward except for these two:

  • 规则:表示目标转换的偏移字符串或对象
  • how : 字符串,下采样或重采样的方法,默认为‘mean’

所以通过查看我在网上找到的尽可能多的例子,我可以看到规则你可以做 'D' 一天,'xMin' 分钟,'xL' 毫秒,但这就是我能找到的.

So from looking at as many examples as I found online I can see for rule you can do 'D' for day, 'xMin' for minutes, 'xL' for milliseconds, but that is all I could find.

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

for how I have seen the following: 'first', np.max, 'last', 'mean', and 'n1n2n3n4...nx' where nx is the first letter of each column index.

那么文档中是否有我遗漏的地方显示了 pandas.resample 规则的每个选项以及如何输入?如果是,在哪里,因为我找不到它.如果不是,他们有哪些选择?

So is there somewhere in the documentation that I am missing that displays every option for pandas.resample's rule and how inputs? If yes, where because I could not find it. If no, what are all the options for them?

推荐答案

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

请参阅时间序列文档.它包括一个偏移(和'anchored' offsets),以及关于重采样.

See the timeseries documentation. It includes a list of offsets (and 'anchored' offsets), and a section about resampling.

请注意,没有列出所有不同的 how 选项,因为它可以是任何 NumPy 数组函数和任何可通过 groupby dispatching 可以通过名称传递给 how.

Note that there isn't a list of all the different how options, because it can be any NumPy array function and any function that is available via groupby dispatching can be passed to how by name.

这篇关于 pandas 重新采样文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆