bdf.normalize#
- bdf.normalize(df: pl.DataFrame | pl.LazyFrame | pd.DataFrame, *, normalizer: TableNormalizer | dict[str, str] | None = None, validate: bool = True, include_unknown: bool = False, tz: str = 'UTC') pl.DataFrame | pl.LazyFrame | pd.DataFrame[source]#
Map vendor columns to BDF canonical names with unit conversion and dtype casting.
Accepts
pl.DataFrame,pl.LazyFrame, orpandas.DataFrame. Return type matches input.validatedefaults to True: this checks required columns even if no normalizer can be auto-detected fromdf’s headers (seeTableNormalizer.normalize). Passvalidate=Falseto fall back to a soft warning instead of raising.- Parameters:
df – Input dataframe in any supported format.
normalizer – Explicit TableNormalizer, column map dict, or None for auto-detection.
validate – Validate column names against the BDF ontology when True (default; raises on missing required columns instead of warning).
include_unknown – Keep columns outside of the BDF spec in the dataframe (default False).
tz – IANA timezone applied to naive
unix_time_seconddatetime formats. Defaults to"UTC"; emits aUserWarningwhen a naive format is in play andtzis left at its default. Around daylight-saving clock changes, repeated local times are converted to the earlier possibleUnix Time / svalue. For example, if clocks move back from UTC+1 to UTC+0,01:30is treated as00:30 UTCrather than01:30 UTC. Local times skipped when clocks move forward become null.
- Returns:
Normalized dataframe in the same format as input.
- Raises:
ValueError – If
tzis not a recognized IANA timezone name.BDFValidationError – If
validate=Trueand required BDF columns are missing.