Skip to content

Commit c56c1be

Browse files
Shivam RanaPingviinituutti
Shivam Rana
authored andcommitted
pandas-dev#23049: test for Fatal Stack Overflow stemming From Misuse of astype('category') (pandas-dev#25366)
1 parent 7578a0c commit c56c1be

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/frame/test_combine_concat.py

+10
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,16 @@ def test_concat_numerical_names(self):
504504
names=[1, 2]))
505505
tm.assert_frame_equal(result, expected)
506506

507+
def test_concat_astype_dup_col(self):
508+
# gh 23049
509+
df = pd.DataFrame([{'a': 'b'}])
510+
df = pd.concat([df, df], axis=1)
511+
512+
result = df.astype('category')
513+
expected = pd.DataFrame(np.array(["b", "b"]).reshape(1, 2),
514+
columns=["a", "a"]).astype("category")
515+
tm.assert_frame_equal(result, expected)
516+
507517

508518
class TestDataFrameCombineFirst(TestData):
509519

0 commit comments

Comments
 (0)