Skip to content

Commit 2a5b9e7

Browse files
committed
TST: added test for cut when labels are tuples of Timestamps (pandas-dev#40661)
1 parent bd94bb1 commit 2a5b9e7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/reshape/test_cut.py

+11
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,14 @@ def test_cut_with_nonexact_categorical_indices():
725725
)
726726

727727
tm.assert_frame_equal(expected, result)
728+
729+
730+
def test_cut_with_timestamp_tuple_labels():
731+
# GH 40661
732+
data = [2, 4, 6]
733+
bins = [1, 3, 5, 7]
734+
labels = [(Timestamp(10),), (Timestamp(20),), (Timestamp(30),)]
735+
result = cut(data, bins=bins, labels=labels)
736+
737+
expected = Categorical.from_codes([0, 1, 2], labels, ordered=True)
738+
tm.assert_categorical_equal(result, expected)

0 commit comments

Comments
 (0)