Lazy query container for transforming one or more timeseries to a new timeseries which is the output of the supplied transformation function.
Each FunctionNode can be transformed to another FunctionNode or computed to a final
SummarizerNode
.
You can also resolve a lazy FunctionNode to a dataframe with FunctionNode.to_pandas()
or
FunctionNode.to_dataframe()
which will yield the transformed time series in the form of a dataframe.
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13
>>> series = F.points( ... (100, 0.0), ... (200, float("inf")), ... (300, 3.14159), ... (2147483647, 1.0), ... name="series" ... ) >>> series.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000100 0.00000 1 1970-01-01 00:00:00.000000200 inf 2 1970-01-01 00:00:00.000000300 3.14159 3 1970-01-01 00:00:02.147483647 1.00000
Copied!1 2 3 4 5 6 7 8 9 10 11
>>> scaled = series.scale(1.5) # scaled is a FunctionNode that is not evaluated yet # scaled can be chained to another FunctionNode operation resulting in another unevaluated FunctionNode >>> time_shifted = scaled.time_shift(1000) # converting time_shifted to a Pandas dataframe evaluates the lazy query with the output of the scaled and # time_shifted functions >>> time_shifted.to_pandas() timestamp value 0 1970-01-01 00:00:00.000001100 0.000000 1 1970-01-01 00:00:00.000001200 inf 2 1970-01-01 00:00:00.000001300 4.712385 3 1970-01-01 00:00:02.147484647 1.500000
Returns a tuple of strings representing the column names of the pandas.DataFrame
that would be produced by evaluating this node to a pandas dataframe.
Keys of nested objects will be flattened into a tuple with nested keys joined with .
.
Copied!1 2 3 4 5 6 7
>>> series_node = foundryts.functions.points(((100, 0.0), (200, 1.0)) >>> series_node.columns() ("timestamp", "value") >>> stats_node = series_node.statistics(start=0, end=100, window_size=None) >>> stats_node.columns() ("count", "smallest_point.timestamp", "start_timestamp", "latest_point.timestamp", "mean", "earliest_point.timestamp", "largest_point.timestamp", "end_timestamp")
See foundryts.functions.cumulative_aggregate()
See foundryts.functions.derivative()
See foundryts.functions.distribution()
See foundryts.functions.first_point()
See foundryts.functions.integral()
See foundryts.functions.interpolate()
See foundryts.functions.last_point()
See foundryts.functions.mean()
See foundryts.functions.periodic_aggregate()
See foundryts.functions.rolling_aggregate()
See foundryts.functions.scale()
See foundryts.functions.scatter()
All series identifiers used by this node and its child nodes.
See foundryts.functions.skip_nonfinite()
See foundryts.functions.statistics()
See foundryts.functions.time_extent()
See foundryts.functions.time_range()
See foundryts.functions.time_shift()
Evaluates this node to a pyspark.sql.DataFrame
.
PySpark DataFrames enable distributed data processing and parallelized transformations. They can be useful when
working with dataframes with a large number of rows, for example loading all the points in a raw series or the
result of a FunctionNode
, or evaluating the results of multiple SummarizerNode
or
FunctionNode
together.
Copied!1 2 3 4 5 6 7 8 9 10 11 12
>>> series_node = F.points( ... (100, 0.0), (200, float("inf")), (300, 3.14159), (2147483647, 1.0), name="series" ... ) >>> series_node.to_dataframe().show() +-------------------------------+---------+ | timestamp | value | +-------------------------------+---------+ | 1970-01-01 00:00:00.000000100 | 0.0 | | 1970-01-01 00:00:00.000000200 | Infinity| | 1970-01-01 00:00:00.000000300 | 3.14159 | | 1970-01-01 00:00:02.147483647 | 1.0 | +-------------------------------+---------+
Evaluates this node to a pandas.DataFrame
.
This is useful for loading raw or transformed time series data into a pandas.DataFrame
and performing transformations using operations provided by pandas.DataFrame
.
Copied!1 2 3 4 5 6 7 8 9
>>> series = F.points( ... (100, 0.0), (200, float("inf")), (300, 3.14159), (2147483647, 1.0), name="series" ... ) >>> series.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000100 0.00000 1 1970-01-01 00:00:00.000000200 inf 2 1970-01-01 00:00:00.000000300 3.14159 3 1970-01-01 00:00:02.147483647 1.00000
Returns a tuple of types for the column of the pandas.DataFrame
that would be produced by evaluating this node to a pandas dataframe.
Copied!1 2 3 4 5 6 7 8 9 10
>>> node = foundryts.functions.points() >>> node.types() (<class 'int'>, <class 'float'>) >>> stats_node = node.statistics(start=0, end=100, window_size=None) >>> stats_node.types() (<class 'int'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'float'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'float'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'float'>, <class 'float'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'float'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>)
See foundryts.functions.unit_conversion()
See foundryts.functions.value_shift()