FivetranAccessor.process_ad_reporting#
- FivetranAccessor.process_ad_reporting(value_columns='impressions', *, date_col='date_day', platform_col='platform', agg='sum', fill_value=0.0, include_missing_dates=False, freq='D', rename_date_to='date')[source]#
Process Fivetran Ad Reporting tables into wide, model-ready features.
Compatible with Fivetran’s Ad Reporting schema tables:
ad_reporting__account_report: daily metrics by account
ad_reporting__campaign_report: daily metrics by campaign and account
ad_reporting__ad_group_report: daily metrics by ad group, campaign and account
ad_reporting__ad_report: daily metrics by ad, ad group, campaign and account
The input data must include a date column, a platform column (e.g., vendor name), and one or more metric columns such as
spend
orimpressions
. The output is a wide dataframe with one row per date and columns named{platform}_{metric}
.- Parameters:
- df
pandas.DataFrame
Input dataframe in long format with at least the date, platform, and metric columns.
- value_columns
str
orSequence
[str
], default “impressions” Column name(s) to aggregate and pivot. Example: “spend” or [“spend”, “impressions”].
- date_col
str
, default “date_day” Name of the date column.
- platform_col
str
, default “platform” Name of the platform (vendor) column.
- agg
str
, default “sum” Aggregation method applied during groupby.
- fill_value
float
orNone
, default 0.0 Value used to fill missing values in the wide output. If
None
, missing values are left as NaN.- include_missing_datesbool, default
False
If
True
, include a continuous date range and fill missing dates usingfill_value
.- freq
str
, default “D” Frequency used when
include_missing_dates
isTrue
.- rename_date_to
str
orNone
, default “date” If provided, rename the date column in the result to this value. If
None
, keepdate_col
.
- df
- Returns:
pandas.DataFrame
A wide-format dataframe with one row per date and columns for each
{platform}_{metric}
combination.