E5E5 BUG: to_datetime with Y or M unit not matching Timestamp by jbrockmendel · Pull Request #50870 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
GH ref
  • Loading branch information
jbrockmendel committed Jan 19, 2023
commit d5b99b5492f7227f6b1c1ca745d8d62b30979b34
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ Datetimelike
- Bug in :func:`to_datetime` was failing to parse date strings ``'today'`` and ``'now'`` if ``format`` was not ISO8601 ( 10673 :issue:`50359`)
- Bug in :func:`Timestamp.utctimetuple` raising a ``TypeError`` (:issue:`32174`)
- Bug in :func:`to_datetime` was raising ``ValueError`` when parsing mixed-offset :class:`Timestamp` with ``errors='ignore'`` (:issue:`50585`)
- Bug in :func:`to_datetime` with unit of "Y" or "M" giving incorrect results, not matching pointwise :class:`Timestamp` results (:issue:`??`)
- Bug in :func:`to_datetime` with unit of "Y" or "M" giving incorrect results, not matching pointwise :class:`Timestamp` results (:issue:`50870`)
-

Timedelta
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/scalar/timestamp/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_constructor_from_date_second_reso(self):

@pytest.mark.parametrize("typ", [int, float])
def test_construct_from_int_float_with_unit_out_of_bound_raises(self, typ):
# make sure we get a OutOfBoundsDatetime instead of OverflowError
# GH#50870 make sure we get a OutOfBoundsDatetime instead of OverflowError
val = typ(150000000)

msg = f"cannot convert input {val} with the unit 'D'"
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/tools/test_to_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ class TestToDatetimeUnit:
@pytest.mark.parametrize("unit", ["Y", "M"])
@pytest.mark.parametrize("item", [150, float(150)])
def test_to_datetime_month_or_year_unit_int(self, cache, unit, item):
# We have separate tests that pd.Timestamp gets these right
# GH#50870 Note we have separate tests that pd.Timestamp gets these right
ts = Timestamp(item, unit=unit)
expected = DatetimeIndex([ts])

Expand Down
0