Skip to content

Commit

Permalink
Static type hint error on class pandera DataFrame (#1207)
Browse files Browse the repository at this point in the history
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
  • Loading branch information
manel-ab authored Jun 1, 2023
1 parent 28c69a7 commit 01bcef2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pandera/typing/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Generic,
List,
Tuple,
Type,
TypeVar,
Union,
_type_check,
Expand Down Expand Up @@ -211,7 +212,7 @@ def pydantic_validate(cls, obj: Any, field: ModelField) -> pd.DataFrame:

@staticmethod
def from_records( # type: ignore
schema: T,
schema: Type[T],
data: Union[ # type: ignore
np.ndarray, List[Tuple[Any, ...]], Dict[Any, Any], pd.DataFrame
],
Expand All @@ -230,7 +231,7 @@ def from_records( # type: ignore
schema_index = schema.index.names if schema.index is not None else None
if "index" not in kwargs:
kwargs["index"] = schema_index
return DataFrame[T](
return DataFrame[schema]( # type: ignore
pd.DataFrame.from_records(data=data, **kwargs,)[
schema.columns.keys()
] # set the column order according to schema
Expand Down

0 comments on commit 01bcef2

Please sign in to comment.