用法:
Series.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.Series.fillna用法及代碼示例
- Python cudf.Series.from_pandas用法及代碼示例
- Python cudf.Series.floordiv用法及代碼示例
- Python cudf.Series.from_categorical用法及代碼示例
- Python cudf.Series.from_masked_array用法及代碼示例
- Python cudf.Series.factorize用法及代碼示例
- Python cudf.Series.floor用法及代碼示例
- Python cudf.Series.from_arrow用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
- Python cudf.Series.update用法及代碼示例
- Python cudf.Series.max用法及代碼示例
- Python cudf.Series.head用法及代碼示例
- Python cudf.Series.reindex用法及代碼示例
- Python cudf.Series.interleave_columns用法及代碼示例
- Python cudf.Series.min用法及代碼示例
- Python cudf.Series.nlargest用法及代碼示例
- Python cudf.Series.to_frame用法及代碼示例
- Python cudf.Series.mask用法及代碼示例
- Python cudf.Series.notnull用法及代碼示例
- Python cudf.Series.isnull用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.first。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。