foundryts.functions.sum

foundryts.functions.sum()

Returns a function that computes the sum of all points sharing a timestamp for multiple input time series.

The resulting time series is a union of all timestamps for all the input series, where each timestamp contains the sum of values that exist across the input set for that timestamp.

  • Returns: A function that accepts multiple time series as inputs and generates a single time series contains a union of all timestamps with the values as the sum of all points in the input time series that share a timestamp.
  • Return type: (NodeCollection) -> FunctionNode

Dataframe schema

Column nameTypeDescription
timestamppandas.TimestampTimestamp of the point
valuefloatValue of the point
See Also

mean()

Note

This function is only applicable to numeric series.

Examples

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 >>> series_1 = F.points( ... (0, 0.0), ... (100, 100.0), ... (140, 140.0), ... (200, 200.0), ... name="series-1" ... ) >>> series_2 = F.points( ... (100, 200.0), ... (120, 220.0), ... (130, 330.0), ... (150, 350.0), ... (160, 460.0), ... name="series-2" ... ) >>> series_1.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000000 0.0 1 1970-01-01 00:00:00.000000100 100.0 2 1970-01-01 00:00:00.000000140 140.0 3 1970-01-01 00:00:00.000000200 200.0 >>> series_2.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000100 200.0 1 1970-01-01 00:00:00.000000120 220.0 2 1970-01-01 00:00:00.000000130 330.0 3 1970-01-01 00:00:00.000000150 350.0 4 1970-01-01 00:00:00.000000160 460.0
Copied!
1 2 3 4 5 6 7 8 9 10 11 >>> sum_series = F.sum()([series_1, series_2]) >>> sum_series.to_pandas() timestamp value 0 1970-01-01 00:00:00.000000000 0.0 1 1970-01-01 00:00:00.000000100 300.0 2 1970-01-01 00:00:00.000000120 220.0 3 1970-01-01 00:00:00.000000130 330.0 4 1970-01-01 00:00:00.000000140 140.0 5 1970-01-01 00:00:00.000000150 350.0 6 1970-01-01 00:00:00.000000160 460.0 7 1970-01-01 00:00:00.000000200 200.0