Skip to content

Commit 982eac4

Browse files
jasonmokkJason Mokmroeschke
authored andcommitted
TST: Add tests for pandas-dev#55431 (pandas-dev#58367)
* Add tests for pandas-dev#55431 * Fix inconsistent pandas namespace usage * Fix inconsistent pandas namespace usage again * Temp disable part of test potentialy due to known bug * Remove unnecessary comments and adjust implementation --------- Co-authored-by: Jason Mok <[email protected]> Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 49c3ce1 commit 982eac4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tests/reshape/test_cut.py

+14
Original file line numberDiff line numberDiff line change
@@ -789,3 +789,17 @@ def test_cut_with_nullable_int64():
789789
result = cut(series, bins=bins)
790790

791791
tm.assert_series_equal(result, expected)
792+
793+
794+
def test_cut_datetime_array_no_attributeerror():
795+
# GH 55431
796+
ser = Series(to_datetime(["2023-10-06 12:00:00+0000", "2023-10-07 12:00:00+0000"]))
797+
798+
result = cut(ser.array, bins=2)
799+
800+
categories = result.categories
801+
expected = Categorical.from_codes([0, 1], categories=categories, ordered=True)
802+
803+
tm.assert_categorical_equal(
804+
result, expected, check_dtype=True, check_category_order=True
805+
)

0 commit comments

Comments
 (0)