Skip to content

Commit b381173

Browse files
committed
Fix DataFrame.from_records type annotations- Update data parameter to use Sequence[SequenceNotStr] | Sequence[Mapping[str, Scalar]] | Mapping[str, Sequence[Scalar]]- Update columns and exclude parameters to use ListLike | None = None- Update index parameter to use SequenceNotStr for better type precisionAddresses review feedback from Dr-Irv on issue #1334
1 parent 4702df7 commit b381173

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,11 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
546546
def from_records(
547547
cls,
548548
data: (
549-
np_2d_array
550-
| Sequence[Any]
551-
| Iterable[Mapping[str, Any]]
552-
| Mapping[str, Sequence[Any]]
549+
Sequence[SequenceNotStr]
550+
| Sequence[Mapping[str, Scalar]]
551+
| Mapping[str, Sequence[Scalar]]
553552
),
554-
index: str | Sequence[str] | None = None,
553+
index: str | SequenceNotStr[str] | None = None,
555554
columns: ListLike | None = None,
556555
exclude: ListLike | None = None,
557556
coerce_float: bool = False,

0 commit comments

Comments
 (0)