Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def to_datetime(
utc: bool = False,
format: str | None = None,
exact: bool | lib.NoDefault = lib.no_default,
unit: str | None = None,
unit: str | None = "us",
origin: str = "unix",
cache: bool = True,
) -> DatetimeIndex | Series | DatetimeScalar | NaTType | None:
Expand Down
13 changes: 13 additions & 0 deletions pandas/tests/tools/test_to_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,19 @@ def test_to_datetime_mixed_offsets_with_utc_false_removed(self, date):
with pytest.raises(ValueError, match=msg):
to_datetime(date, utc=False)

@pytest.mark.parametrize(
"date",
[
"2024-03-22 11:43:01",
"2024-03-22 11:43:01.002",
"2024-03-22 11:43:01.002003",
],
)
def test_to_datetime_type(self, date):
dt = to_datetime([date])
print("pranav dtype is ", dt.dtype)
assert dt.dtype == "<M8[us]"


class TestToDatetimeUnit:
@pytest.mark.parametrize("unit", ["Y", "M"])
Expand Down