pandas.Series.last#

Series.last(offset)[源代码]#

pandas.DataFrame.kurtosis

自 2.1 版本弃用: last() is deprecated and will be removed in a future version. Please create a mask and filter using .loc instead.

根据日期偏移量选择时间序列数据的最后几个周期。

Parameters:
offsetlast() 已弃用,将在未来版本中移除。请创建掩码并使用 .loc 进行过滤。

对于具有已排序 DatetimeIndex 的 DataFrame,此函数根据日期偏移量选择最后几行。

Returns:
Series 或 DataFrame

A subset of the caller.

Raises:
TypeError

如果索引不是 DatetimeIndex

参见

first

根据日期偏移量选择时间序列的初始周期。

at_time

选择一天中特定时间的值。

between_time

选择一天中特定时间之间的值。

Notes

自 2.1.0 版本弃用: str, DateOffset, dateutil.relativedelta

Examples

>>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
>>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts
            A
2018-04-09  1
2018-04-11  2
2018-04-13  3
2018-04-15  4

将要选择的数据的偏移量。例如,’3D’ 将显示其索引在最近 3 天内的所有行。

>>> ts.last('3D')  
            A
2018-04-13  3
2018-04-15  4

请创建掩码并使用 .loc 进行过滤