Skip to content

Commit 3be28c9

Browse files
GH1352 PR Feedback
1 parent fba129c commit 3be28c9

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

pandas-stubs/core/tools/datetimes.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ DatetimeScalar: TypeAlias = Scalar | datetime | np.datetime64 | date
3838

3939
DatetimeScalarOrArrayConvertible: TypeAlias = DatetimeScalar | ArrayConvertible
4040

41-
DatetimeDictArg: TypeAlias = list[Scalar] | tuple[Scalar, ...] | AnyArrayLike | int
41+
DatetimeDictArg: TypeAlias = (
42+
list[int | str] | tuple[int | str, ...] | AnyArrayLike | int | str
43+
)
4244

4345
class YearMonthDayDict(TypedDict, total=True):
4446
year: DatetimeDictArg

tests/test_timefuncs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,20 @@ def test_to_datetime_series() -> None:
13421342
{
13431343
"year": ts.year,
13441344
"month": ts.month,
1345+
"day": "1",
1346+
}
1347+
),
1348+
"TimestampSeries",
1349+
),
1350+
pd.Series,
1351+
pd.Timestamp,
1352+
)
1353+
check(
1354+
assert_type(
1355+
pd.to_datetime(
1356+
{
1357+
"year": [2024, "2023"],
1358+
"month": 4,
13451359
"day": 1,
13461360
}
13471361
),

0 commit comments

Comments
 (0)