用法:
DataFrame.first(offset)
根據日期偏移選擇時間序列數據的初始期間。
當有一個以排序日期為索引的 DataFrame 時,此函數可以根據日期偏移量選擇前幾行。
- offset: str:
將選擇的數據的偏移長度。例如,“1M”將顯示第一個月內具有索引的所有行。
- Series或DataFrame
調用者的子集。
- TypeError
如果索引不是
DatetimeIndex
參數:
返回:
拋出:
例子:
>>> i = cudf.date_range('2018-04-09', periods=4, freq='2D') >>> ts = cudf.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 >>> ts.first('3D') A 2018-04-09 1 2018-04-11 2
相關用法
- Python cudf.DataFrame.fillna用法及代碼示例
- Python cudf.DataFrame.from_pandas用法及代碼示例
- Python cudf.DataFrame.floordiv用法及代碼示例
- Python cudf.DataFrame.floor用法及代碼示例
- Python cudf.DataFrame.from_arrow用法及代碼示例
- Python cudf.DataFrame.mod用法及代碼示例
- Python cudf.DataFrame.isin用法及代碼示例
- Python cudf.DataFrame.rmul用法及代碼示例
- Python cudf.DataFrame.apply用法及代碼示例
- Python cudf.DataFrame.exp用法及代碼示例
- Python cudf.DataFrame.drop用法及代碼示例
- Python cudf.DataFrame.where用法及代碼示例
- Python cudf.DataFrame.median用法及代碼示例
- Python cudf.DataFrame.to_pandas用法及代碼示例
- Python cudf.DataFrame.take用法及代碼示例
- Python cudf.DataFrame.tail用法及代碼示例
- Python cudf.DataFrame.rfloordiv用法及代碼示例
- Python cudf.DataFrame.equals用法及代碼示例
- Python cudf.DataFrame.head用法及代碼示例
- Python cudf.DataFrame.count用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.DataFrame.first。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。