From cf3f998d560990dda3d3eac3130ff042b33b429b Mon Sep 17 00:00:00 2001 From: "Brandon M. Burroughs" Date: Mon, 10 Oct 2016 20:10:33 -0400 Subject: [PATCH] Adding ValueError test for concat Series axis 'columns' --- pandas/tests/frame/test_combine_concat.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pandas/tests/frame/test_combine_concat.py b/pandas/tests/frame/test_combine_concat.py index c1a84e970feca..41b3c6358a239 100644 --- a/pandas/tests/frame/test_combine_concat.py +++ b/pandas/tests/frame/test_combine_concat.py @@ -361,6 +361,18 @@ def test_concat_axis_parameter(self): concatted_columns = pd.concat([df1, df2], axis='columns') assert_frame_equal(concatted_columns, expected_columns) + series1 = pd.Series([0.1, 0.2]) + series2 = pd.Series([0.3, 0.4]) + + expected_row_series = pd.Series( + [0.1, 0.2, 0.3, 0.4], index=[0, 1, 0, 1]) + concatted_row_series = pd.concat([series1, series2], axis='rows') + assert_series_equal(concatted_row_series, expected_row_series) + + # A Series has no 'columns' axis + with assertRaisesRegexp(ValueError, 'No axis named columns'): + pd.concat([series1, series2], axis='columns') + class TestDataFrameCombineFirst(tm.TestCase, TestData):