Skip to content

Commit 1c6e23d

Browse files
committed
Don't pass nanosecond when user passes datetime.date
1 parent a8a4f0b commit 1c6e23d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Diff for: pandas/_libs/tslibs/conversion.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ cdef convert_to_tsobject(object ts, object tz, object unit,
301301
elif PyDate_Check(ts):
302302
# Keep the converter same as PyDateTime's
303303
ts = datetime.combine(ts, datetime_time())
304-
return convert_datetime_to_tsobject(ts, tz, nanos)
304+
return convert_datetime_to_tsobject(ts, tz)
305305
elif getattr(ts, '_typ', None) == 'period':
306306
raise ValueError("Cannot convert Period to Timestamp "
307307
"unambiguously. Use to_timestamp")

Diff for: pandas/tests/scalar/timestamp/test_timestamp.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from dateutil.tz import tzutc
1010
from pytz import timezone, utc
11-
from datetime import datetime, timedelta, date
11+
from datetime import datetime, timedelta
1212

1313
import pandas.util.testing as tm
1414
import pandas.util._test_decorators as td
@@ -387,7 +387,6 @@ def test_constructor_fromordinal(self):
387387

388388
@pytest.mark.parametrize('result', [
389389
Timestamp(datetime(2000, 1, 1), nanosecond=1),
390-
Timestamp(date(2000, 1, 1), nanosecond=1),
391390
Timestamp(year=2000, month=1, day=1, nanosecond=1),
392391
Timestamp(year=2000, month=1, day=1, tz='UTC', nanosecond=1),
393392
Timestamp(2000, 1, 1, 0, 0, 0, 0, None, 1),

0 commit comments

Comments
 (0)