注: 以下の翻訳の正確性は検証されていません。AIPを利用して英語版の原文から機械的に翻訳されたものです。
単一の系列をウィンドウにパーティション分割し、各ウィンドウの統計量を計算する関数を返します。
系列は window 引数を使用してウィンドウにパーティション分割されます。各ウィンドウには、 Dataframe スキーマに記載された統計量が含まれます。統計量は、周期 (各ウィンドウの幅)に基づいて作成されたローリングウィンドウ、または round(データポイントの総数 / バケット数) を使用して幅を計算した固定数のローリングウィンドウに対して計算されます。 ローリングウィンドウに使用されるオプションは、渡された window または window_count 引数によって決まります。
start (Union [int , datetime , str ] , 任意) – 指定された系列のウィンドウへのパーティション分割を開始するタイムスタンプ(この値を含む)。(デフォルトは系列全体)
end (Union [int , datetime , str ] , 任意) – 指定された系列のウィンドウへのパーティション分割を終了するタイムスタンプ(この値を含む)。(デフォルトは系列全体)
window (Union [int , datetime , str ] , 任意) –
各ウィンドウの幅を表す timedelta です。各ウィンドウのサイズを使用して、系列を :いくつかのウィンドウに分割します。(デフォルトは系列全体)
**kwargs – ウィンドウの動作と出力タイプを決定するフラグです。
| 列名 | データ型 | 説明 |
|---|---|---|
| count | int | 入力系列のウィンドウ内の データポイントの件数。 |
| earliest_point.timestamp | datetime | 入力系列のウィンドウ内の 最初のデータポイントのタイムスタンプ。 |
| earliest_point.value | float | 入力系列のウィンドウ内の 最初のデータポイントの値。 |
| end_timestamp | datetime | 最後のデータポイントのタイムスタンプ |
| largest_point.timestamp | datetime | 入力系列のウィンドウ内で 最大値を持つデータポイントのタイムスタンプ。 |
| largest_point.value | float | 入力系列のウィンドウ内の最大値。 |
| latest_point.timestamp | datetime | 入力系列のウィンドウ内の 最新のデータポイントのタイムスタンプ。 |
| latest_point.value | float | 入力系列のウィンドウ内の 最新のデータポイントの値。 |
| mean | float | 入力系列のウィンドウ内の すべてのデータポイントの平均値。 |
| smallest_point.timestamp | datetime | 入力系列のウィンドウ内で 最小値を持つデータポイントのタイムスタンプ。 |
| smallest_point.value | float | 入力系列のウィンドウ内の最小値。 |
| start_timestamp | datetime | 最初のデータポイントのタイムスタンプ |
この関数は数値系列にのみ適用できます。
今後、この機能がデフォルトになるため、include_std_dev キーワード引数は非推奨になる予定です。
window_count は include_std_dev と併用する場合にのみ使用でき、 window より優先されます。include_std_dev なしで渡された場合、window_count は無視されます。
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19>>> series = F.points( ... (1, 8.0), ... (101, 4.0), ... (200, 2.0), ... (201, 1.0), ... (299, 35.0), ... (300, 16.0), ... (350, 32.0), ... (1000, 64.0), ... ) timestamp value 0 1970-01-01 00:00:00.000000001 8.0 1 1970-01-01 00:00:00.000000101 4.0 2 1970-01-01 00:00:00.000000200 2.0 3 1970-01-01 00:00:00.000000201 1.0 4 1970-01-01 00:00:00.000000299 35.0 5 1970-01-01 00:00:00.000000300 16.0 6 1970-01-01 00:00:00.000000350 32.0 7 1970-01-01 00:00:00.000001000 64.0
Copied!1 2 3 4 5 6 7 8>>> stats = F.statistics(window="100ns")(series) # 時間ベースのウィンドウを使用します >>> stats.to_pandas() count earliest_point.timestamp earliest_point.value end_timestamp largest_point.timestamp largest_point.value latest_point.timestamp latest_point.value mean smallest_point.timestamp smallest_point.value start_timestamp 0 1 1970-01-01 00:00:00.000000001 8.0 1970-01-01 00:00:00.000000100 1970-01-01 00:00:00.000000001 8.0 1970-01-01 00:00:00.000000001 8.0 8.000000 1970-01-01 00:00:00.000000001 8.0 1970-01-01 00:00:00.000000000 1 1 1970-01-01 00:00:00.000000101 4.0 1970-01-01 00:00:00.000000200 1970-01-01 00:00:00.000000101 4.0 1970-01-01 00:00:00.000000101 4.0 4.000000 1970-01-01 00:00:00.000000101 4.0 1970-01-01 00:00:00.000000100 2 3 1970-01-01 00:00:00.000000200 2.0 1970-01-01 00:00:00.000000300 1970-01-01 00:00:00.000000299 35.0 1970-01-01 00:00:00.000000299 35.0 12.666667 1970-01-01 00:00:00.000000201 1.0 1970-01-01 00:00:00.000000200 3 2 1970-01-01 00:00:00.000000300 16.0 1970-01-01 00:00:00.000000400 1970-01-01 00:00:00.000000350 32.0 1970-01-01 00:00:00.000000350 32.0 24.000000 1970-01-01 00:00:00.000000300 16.0 1970-01-01 00:00:00.000000300 4 1 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001100 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001000 64.0 64.000000 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001000
Copied!1 2 3 4 5 6 7 8>>> stats_with_std_dev = F.statistics(window="100ns", include_std_dev=True)(series) >>> stats_with_std_dev.to_pandas() count earliest_point.timestamp earliest_point.value end_timestamp largest_point.timestamp largest_point.value latest_point.timestamp latest_point.value mean smallest_point.timestamp smallest_point.value standard_deviation start_timestamp 0 1 1970-01-01 00:00:00.000000001 8.0 1970-01-01 00:00:00.000000100 1970-01-01 00:00:00.000000001 8.0 1970-01-01 00:00:00.000000001 8.0 8.000000 1970-01-01 00:00:00.000000001 8.0 0.000000 1970-01-01 00:00:00.000000000 1 1 1970-01-01 00:00:00.000000101 4.0 1970-01-01 00:00:00.000000200 1970-01-01 00:00:00.000000101 4.0 1970-01-01 00:00:00.000000101 4.0 4.000000 1970-01-01 00:00:00.000000101 4.0 0.000000 1970-01-01 00:00:00.000000100 2 3 1970-01-01 00:00:00.000000200 2.0 1970-01-01 00:00:00.000000300 1970-01-01 00:00:00.000000299 35.0 1970-01-01 00:00:00.000000299 35.0 12.666667 1970-01-01 00:00:00.000000201 1.0 15.797327 1970-01-01 00:00:00.000000200 3 2 1970-01-01 00:00:00.000000300 16.0 1970-01-01 00:00:00.000000400 1970-01-01 00:00:00.000000350 32.0 1970-01-01 00:00:00.000000350 32.0 24.000000 1970-01-01 00:00:00.000000300 16.0 8.000000 1970-01-01 00:00:00.000000300 4 1 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001100 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001000 64.0 64.000000 1970-01-01 00:00:00.000001000 64.0 0.000000 1970-01-01 00:00:00.000001000
Copied!1 2 3 4 5 6>>> stats_fixed_window_count = F.statistics(include_std_dev=True, window_count=3)(series) >>> stats_fixed_window_count.to_pandas() count earliest_point.timestamp earliest_point.value end_timestamp largest_point.timestamp largest_point.value latest_point.timestamp latest_point.value mean smallest_point.timestamp smallest_point.value standard_deviation start_timestamp 0 6 1970-01-01 00:00:00.000000001 8.0 1970-01-01 00:00:00.000000335 1970-01-01 00:00:00.000000299 35.0 1970-01-01 00:00:00.000000300 16.0 11.0 1970-01-01 00:00:00.000000201 1.0 11.83216 1970-01-01 00:00:00.000000001 1 1 1970-01-01 00:00:00.000000350 32.0 1970-01-01 00:00:00.000000669 1970-01-01 00:00:00.000000350 32.0 1970-01-01 00:00:00.000000350 32.0 32.0 1970-01-01 00:00:00.000000350 32.0 0.00000 1970-01-01 00:00:00.000000335 2 1 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001003 1970-01-01 00:00:00.000001000 64.0 1970-01-01 00:00:00.000001000 64.0 64.0 1970-01-01 00:00:00.000001000 64.0 0.00000 1970-01-01 00:00:00.000000669