diff --git a/pandera/typing/formats.py b/pandera/typing/formats.py index 1585263df..0f88d5089 100644 --- a/pandera/typing/formats.py +++ b/pandera/typing/formats.py @@ -42,6 +42,9 @@ class Formats(Enum): #: python pickle file format pickle = "pickle" + #: python json_normalize + json_normalize = "json_normalize" + Format = Union[ Literal[Formats.csv], @@ -50,4 +53,5 @@ class Formats(Enum): Literal[Formats.feather], Literal[Formats.parquet], Literal[Formats.pickle], + Literal[Formats.json_normalize], ] diff --git a/pandera/typing/pandas.py b/pandera/typing/pandas.py index 9c2a0b7c3..8e26962e7 100644 --- a/pandera/typing/pandas.py +++ b/pandera/typing/pandas.py @@ -122,6 +122,7 @@ def from_format(cls, obj: Any, config) -> pd.DataFrame: Formats.feather: pd.read_feather, Formats.parquet: pd.read_parquet, Formats.pickle: pd.read_pickle, + Formats.json_normalize: pd.json_normalize, }[Formats(config.from_format)] return reader(obj, **(config.from_format_kwargs or {})) # type: ignore