跳转至

foundryts.functions.time_extent(foundryts.functions.time_extent)

foundryts.functions.time_extent()

Returns a function that extracts the time extent (earliest and latest timestamps) of a single time series.

The returned function computes the time extent by identifying the range from the first to the last timestamp in the given time series.

  • Returns: A function that accepts a single time series and returns its time extent. The dataframe contains a single row with the time extent.
  • Return type: (FunctionNode) -> SummarizerNode

Dataframe schema

Column name Type Description
extent.earliest_timestamp pandas.Timestamp Timestamp of the first point in the series.
extent.latest_timestamp pandas.Timestamp Timestamp of the last point in the series.

Examples

>>> series = F.points(
...     (1, 0.0),
...     (101, 10.2),
...     (200, 11.3),
...     (123450, 11.8),
... )
>>> series.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000001    0.0
1 1970-01-01 00:00:00.000000101   10.2
2 1970-01-01 00:00:00.000000200   11.3
3 1970-01-01 00:00:00.000123450   11.8
>>> time_ext = F.time_extent()(series)
>>> time_ext.to_pandas()
      extent.earliest_timestamp       extent.latest_timestamp
0 1970-01-01 00:00:00.000000001 1970-01-01 00:00:00.000123450

中文翻译


foundryts.functions.time_extent

foundryts.functions.time_extent()

返回一个函数,用于提取单个时间序列的时间范围(最早和最晚时间戳)。

该返回的函数通过识别给定时间序列中从第一个到最后一个时间戳的范围来计算时间范围。

  • 返回值: 一个接受单个时间序列并返回其时间范围的函数。数据框包含一行时间范围数据。
  • 返回类型: (FunctionNode) -> SummarizerNode

数据框模式(Dataframe schema)

列名 类型 描述
extent.earliest_timestamp pandas.Timestamp 序列中第一个点的时间戳。
extent.latest_timestamp pandas.Timestamp 序列中最后一个点的时间戳。

示例

>>> series = F.points(
...     (1, 0.0),
...     (101, 10.2),
...     (200, 11.3),
...     (123450, 11.8),
... )
>>> series.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000001    0.0
1 1970-01-01 00:00:00.000000101   10.2
2 1970-01-01 00:00:00.000000200   11.3
3 1970-01-01 00:00:00.000123450   11.8
>>> time_ext = F.time_extent()(series)
>>> time_ext.to_pandas()
      extent.earliest_timestamp       extent.latest_timestamp
0 1970-01-01 00:00:00.000000001 1970-01-01 00:00:00.000123450