跳转至

foundryts.functions.first_point

foundryts.functions.first_point()

Returns a function that extracts the earliest point for a single time series.

The returned point is the first occuring point within the range of a given time series. Returns an empty summary when the series is empty.

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

Dataframe schema

Column name Type Description
timestamp pandas.Timestamp Timestamp of the point
value Union[float, str] Value of the point

:::callout{theme="success" title="See Also"} time_extent(), last_point() :::

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
>>> fp = F.first_point()(series)
>>> fp.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000001    0.0

中文翻译

foundryts.functions.first_point

foundryts.functions.first_point()

返回一个函数,用于提取单个时间序列中的最早数据点。

返回的数据点是给定时间序列范围内第一个出现的数据点。当序列为空时,返回空摘要。

  • 返回值: 一个接受单个时间序列并返回该序列中第一个数据点的函数。数据帧(DataFrame)包含一行,即第一个数据点。
  • 返回类型: (FunctionNode) -> SummarizerNode

数据帧模式(Dataframe schema)

列名(Column name) 类型(Type) 描述(Description)
timestamp pandas.Timestamp 数据点的时间戳
value Union[float, str] 数据点的值

:::callout{theme="success" title="另请参阅(See Also)"} time_extent(), last_point() :::

示例(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
>>> fp = F.first_point()(series)
>>> fp.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000001    0.0