custom_dataset#
Use custom data functions when the panel does not come from FRED-MD, FRED-QD,
or FRED-SD. The output must still be a canonical DataBundle: a date-indexed
numeric panel plus metadata that later stages can read.
Function Choices#
Function |
Input |
Output |
Use case |
|---|---|---|---|
|
in-memory |
|
User code already loaded the data. |
|
CSV path |
|
File source is CSV. |
|
Parquet path |
|
File source is Parquet. |
custom_dataset#
mf.data.custom_dataset(
data,
*,
date=None,
columns=None,
dataset="custom",
frequency=None,
transform_codes=None,
metadata=None,
) -> mf.data.DataBundle
Input#
Name |
Type |
Meaning |
|---|---|---|
|
|
User panel. It can contain a date column or already have a |
|
str or |
Date column to move into the index. Use |
|
sequence or |
Optional variable subset after date handling. |
|
str |
Dataset label stored in metadata. |
|
str or mapping or |
Panel frequency such as |
|
mapping or |
Optional FRED-style transformation code metadata by column. |
|
mapping or |
User metadata to merge into the bundle metadata. |
Output#
Field |
Contract |
|---|---|
|
Numeric |
|
Dataset name. |
|
Dataset-level or column-level frequency information when supplied. |
|
Transform-code metadata when supplied. |
|
Normalization report for date/index/column conversion. |
Flow#
bundle = mf.data.custom_dataset(
frame,
date="date",
dataset="local_macro",
frequency="monthly",
transform_codes={"target": 1, "x": 1},
)
processed = mf.preprocessing.reprocess(bundle, transform="none")
File Loaders#
mf.data.load_custom_csv(path, *, date, columns=None, dataset="custom", ...)
mf.data.load_custom_parquet(path, *, date, columns=None, dataset="custom", ...)
The file loaders normalize the same panel contract as custom_dataset().
Use them when the file path itself should appear in the loader metadata.
Validation#
Problem |
Behavior |
|---|---|
Missing date column |
raises loader/normalization error. |
Duplicate dates |
raises unless permissive mode is explicitly requested by the loader. |
Non-numeric selected variables |
coerced or reported by panel normalization. |
Missing frequency metadata |
allowed, but frequency-aware downstream logic may need explicit |