Ciaren

Time Series Analysis

Time Series Analysis

Turn a stream of time-stamped events into a tidy monthly summary. Ciaren does this by extracting date parts and grouping by them.

You'll use: File Input → Change Types → Extract Date Parts → Group by + Aggregate → Rename → Sort → File Output.

File Input
events.csv
input
Change Types
occurred_at→datetime · value→float
clean
Extract Date Parts
adds occurred_at_year, occurred_at_month
transform
Group By + Aggregate
by year+month · sum(value) · count(events)
transform
Rename Columns
value→total_value · event_id→num_events
clean
Sort Rows
year asc, month asc
clean
File Output
monthly_summary.csv
output

Scope

Ciaren aggregates time data by calendar period (year, month, day, weekday, hour). It does not do rolling windows or resample-style smoothing — for those, export the Python and add a .rolling(...) step. See Next steps below.

Sample data

events.csv:

event_id,occurred_at,value
1,2024-01-05,10
2,2024-01-20,14
3,2024-02-02,9
4,2024-02-18,21
5,2024-03-01,17
6,2024-03-29,13

Upload it on the Datasets page (📥 download events.csv).

Build the flow

  1. File Input — File type CSV, select events.csv.
  2. Change Typescasts: { "occurred_at": "datetime", "value": "float" }.
  3. Extract Date Partscolumn: "occurred_at", parts: ["year", "month"]. This adds occurred_at_year and occurred_at_month columns.
  4. Group by + Aggregategroup_by: ["occurred_at_year", "occurred_at_month"], aggregations: { "value": "sum", "event_id": "count" }.
  5. Rename Columnsmapping: { "value": "total_value", "event_id": "num_events" }.
  6. Sort Rowscolumns: ["occurred_at_year", "occurred_at_month"], ascending: true.
  7. File Outputformat: csv (name monthly_summary).

Exported Python

import pandas as pd

df_events = pd.read_csv('events.csv')
df_events = df_events.assign(occurred_at=lambda _d: pd.to_datetime(_d['occurred_at']), value=lambda _d: _d['value'].astype('float64'))
_dt = pd.to_datetime(df_events['occurred_at'])
df_events = df_events.assign(occurred_at_year=_dt.dt.year, occurred_at_month=_dt.dt.month)

df_events = (
    df_events.groupby(['occurred_at_year', 'occurred_at_month'])
    .agg({'value': 'sum', 'event_id': 'count'})
    .reset_index()
    .rename(columns={'value': 'total_value', 'event_id': 'num_events'})
    .sort_values(['occurred_at_year', 'occurred_at_month'])
)

df_events.to_csv('monthly_summary.csv', index=False)

Result

The raw event-level rows are collapsed into monthly summaries. The date column is split into year and month so each period becomes its own group key.

Before
event_idoccurred_atvalue
12024-01-0510
22024-01-2014
32024-02-029
42024-02-1821
52024-03-0117
62024-03-2913
6 rows · 3 cols
Full flow
After
occurred_at_yearnewoccurred_at_monthnewtotal_valuenewnum_eventsnew
20241242
20242302
20243302
3 rows · 4 cols

Next steps

  • Smoothing / moving averages. Export the flow and add a rolling window to the result, e.g. df_events['rolling_avg'] = df_events['total_value'].rolling(3).mean().
  • Day-of-week patterns. Add weekday to the Extract Date Parts node and group by it instead.
  • Data Quality Checks