python - Pandas 重采样文档

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

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

  • rule : 表示目标转换的偏移量字符串或对象
  • how : 字符串,下采样或重采样的方法,默认为“mean”

因此,通过查看我在网上找到的尽可能多的示例,我可以看到规则您可以执行 'D' 一天,'xMin' 分钟,'xL' 毫秒,但我只能找到这些。

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

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

最佳答案

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

见 timeseries documentation .它包括 offsets 的列表(和 'anchored' offsets ),以及关于 resampling 的部分.

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

关于python - Pandas 重采样文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17001389/

相关文章:

linux - 我可以使用 GDB 调试正在运行的进程吗?

linux - 如何在 Bash 中列出每个文件和目录的大小并按大小降序排序?

linux - Linux 上的 PostgreSQL 数据库默认位置

python - 检查数字是 int 还是 float

Python请求 - 打印整个http请求(原始)?

python - 在 Python 中格式化多行 dict 的正确方法是什么?

python - Python NumPy 中的 np.mean() 与 np.average()?

python - 设置 Django 以使用 MySQL

linux - 如何根据字段的数值对文件进行排序?

linux - 如何将 AWS CLI 升级到最新版本?