Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.data.load.XrDatasetDataLoader
Stay organized with collections
Save and categorize content based on your preferences.
Reads data from an xarray.Dataset
object.
Inherits From: InputDataLoader
meridian.data.load.XrDatasetDataLoader(
dataset: xr.Dataset,
kpi_type: str,
name_mapping: (Mapping[str, str] | None) = None
)
Example:
data_loader = XrDatasetDataLoader(pickle.loads('data.pickle'))
data = data_loader.load()
Args |
dataset
|
An xarray.Dataset object containing the input data.
|
kpi_type
|
A string denoting whether the KPI is of a 'revenue' or
'non-revenue' type. When the kpi_type is 'non-revenue' and
revenue_per_kpi exists, ROI calibration is used and the analysis is
run on revenue. When revenue_per_kpi doesn't exist for the same
kpi_type , custom ROI calibration is used and the analysis is run on
KPI.
|
name_mapping
|
An optional dictionary whose keys are the current
coordinates or array names in the input dataset and whose values are
the desired coordinates (geo , time , media_time , media_channel
and/or rf_channel , control_variable , non_media_channel ,
organic_media_channel , organic_rf_channel ) or array names (kpi ,
revenue_per_kpi , media , media_spend and/or rf_spend , controls ,
population , non_media_treatments , organic_media , organic_reach ,
organic_frequency ). Mapping must be provided if the names in the
input dataset are different from the required ones, otherwise errors
are thrown.
|
Attributes |
dataset
|
An xr.Dataset object containing the input data.
|
kpi_type
|
A string denoting whether the KPI is of a 'revenue' or
'non-revenue' type. When the kpi_type is 'non-revenue' and
revenue_per_kpi exists, ROI calibration is used and the analysis is run
on revenue. When revenue_per_kpi doesn't exist for the same kpi_type ,
custom ROI calibration is used and the analysis is run on KPI.
|
Methods
load
View source
load() -> meridian.data.input_data.InputData
Returns an InputData
object containing the data from the dataset.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-23 UTC."],[],[],null,[]]