跳转至

foundryts.functions.timestamp_scale

foundryts.functions.timestamp_scale(factor)

(DEPRECATED) Returns a function that multiplies each timestamp of a single time series by the specified integer factor.

For a source time series with points (timestamp, value), upon scaling by factor, the resulting time-scaled time series will have points (timestamp * factor, value).

  • Parameters: factor (int) – The scaling factor that is multiplied with each timestamp in the series.
  • Returns: A function that accepts a single time series as input and returns the time-scaled time series.
  • Return type: (FunctionNode) -> FunctionNode

Dataframe schema

Column name Type Description
timestamp pandas.Timestamp Timestamp of the point
value float Scaled value of the point

:::callout{theme="success" title="See Also"} scale(), time_shift(), value_shift() :::

:::callout{theme="warning" title="Note"} This operation is deprecated and performs a no-op, leaving the resulting time series unchanged. This function will be removed from future releases.

The backend will automatically unify different time-units to the same unit. :::

Examples

>>> series = F.points(
...     (1, 1.0),
...     (101, 2.0),
...     (200, 4.0),
...     (201, 8.0),
...     name="series",
... )
>>> series.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000001    1.0
1 1970-01-01 00:00:00.000000101    2.0
2 1970-01-01 00:00:00.000000200    4.0
3 1970-01-01 00:00:00.000000201    8.0
>>> timescaled_series = F.timestamp_scale(99)(series) # NO-OP, DEPRECATED OPERATION
>>> timescaled_series.to_pandas() # resulting series is unchanged
                      timestamp  value
0 1970-01-01 00:00:00.000000001    1.0
1 1970-01-01 00:00:00.000000101    2.0
2 1970-01-01 00:00:00.000000200    4.0
3 1970-01-01 00:00:00.000000201    8.0

中文翻译

foundryts.functions.timestamp_scale

foundryts.functions.timestamp_scale(factor)

(已弃用)返回一个函数,该函数将单个时间序列中的每个时间戳乘以指定的整数因子。

对于包含数据点 (timestamp, value) 的源时间序列,经过 factor 缩放后,时间缩放后的时间序列将包含数据点 (timestamp * factor, value)

  • 参数: factor (int) – 与序列中每个时间戳相乘的缩放因子。
  • 返回值: 一个函数,接受单个时间序列作为输入,并返回时间缩放后的时间序列。
  • 返回类型: (FunctionNode) -> FunctionNode

数据框模式(Dataframe schema)

列名 类型 描述
timestamp pandas.Timestamp 数据点的时间戳
value float 数据点的缩放后的值

:::callout{theme="success" title="另请参阅"} scale(), time_shift(), value_shift() :::

:::callout{theme="warning" title="注意"} 此操作已弃用,执行空操作(no-op),结果时间序列保持不变。此函数将在未来版本中移除。

后端会自动将不同的时间单位统一为相同单位。 :::

示例

>>> series = F.points(
...     (1, 1.0),
...     (101, 2.0),
...     (200, 4.0),
...     (201, 8.0),
...     name="series",
... )
>>> series.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000001    1.0
1 1970-01-01 00:00:00.000000101    2.0
2 1970-01-01 00:00:00.000000200    4.0
3 1970-01-01 00:00:00.000000201    8.0
>>> timescaled_series = F.timestamp_scale(99)(series) # 空操作,已弃用操作
>>> timescaled_series.to_pandas() # 结果序列保持不变
                      timestamp  value
0 1970-01-01 00:00:00.000000001    1.0
1 1970-01-01 00:00:00.000000101    2.0
2 1970-01-01 00:00:00.000000200    4.0
3 1970-01-01 00:00:00.000000201    8.0