@@ -17,7 +17,7 @@ def test_concat_multiple_frames_dtypes(self):
1717 # GH#2759
1818 A = DataFrame (data = np .ones ((10 , 2 )), columns = ["foo" , "bar" ], dtype = np .float64 )
1919 B = DataFrame (data = np .ones ((10 , 2 )), dtype = np .float32 )
20- results = pd . concat ((A , B ), axis = 1 ).dtypes
20+ results = concat ((A , B ), axis = 1 ).dtypes
2121 expected = Series (
2222 [np .dtype ("float64" )] * 2 + [np .dtype ("float32" )] * 2 ,
2323 index = ["foo" , "bar" , 0 , 1 ],
@@ -28,7 +28,7 @@ def test_concat_tuple_keys(self):
2828 # GH#14438
2929 df1 = DataFrame (np .ones ((2 , 2 )), columns = list ("AB" ))
3030 df2 = DataFrame (np .ones ((3 , 2 )) * 2 , columns = list ("AB" ))
31- results = pd . concat ((df1 , df2 ), keys = [("bee" , "bah" ), ("bee" , "boo" )])
31+ results = concat ((df1 , df2 ), keys = [("bee" , "bah" ), ("bee" , "boo" )])
3232 expected = DataFrame (
3333 {
3434 "A" : {
@@ -53,20 +53,18 @@ def test_concat_named_keys(self):
5353 # GH#14252
5454 df = DataFrame ({"foo" : [1 , 2 ], "bar" : [0.1 , 0.2 ]})
5555 index = Index (["a" , "b" ], name = "baz" )
56- concatted_named_from_keys = pd . concat ([df , df ], keys = index )
56+ concatted_named_from_keys = concat ([df , df ], keys = index )
5757 expected_named = DataFrame (
5858 {"foo" : [1 , 2 , 1 , 2 ], "bar" : [0.1 , 0.2 , 0.1 , 0.2 ]},
5959 index = pd .MultiIndex .from_product ((["a" , "b" ], [0 , 1 ]), names = ["baz" , None ]),
6060 )
6161 tm .assert_frame_equal (concatted_named_from_keys , expected_named )
6262
6363 index_no_name = Index (["a" , "b" ], name = None )
64- concatted_named_from_names = pd .concat (
65- [df , df ], keys = index_no_name , names = ["baz" ]
66- )
64+ concatted_named_from_names = concat ([df , df ], keys = index_no_name , names = ["baz" ])
6765 tm .assert_frame_equal (concatted_named_from_names , expected_named )
6866
69- concatted_unnamed = pd . concat ([df , df ], keys = index_no_name )
67+ concatted_unnamed = concat ([df , df ], keys = index_no_name )
7068 expected_unnamed = DataFrame (
7169 {"foo" : [1 , 2 , 1 , 2 ], "bar" : [0.1 , 0.2 , 0.1 , 0.2 ]},
7270 index = pd .MultiIndex .from_product ((["a" , "b" ], [0 , 1 ]), names = [None , None ]),
@@ -81,24 +79,24 @@ def test_concat_axis_parameter(self):
8179 # Index/row/0 DataFrame
8280 expected_index = DataFrame ({"A" : [0.1 , 0.2 , 0.3 , 0.4 ]}, index = [0 , 1 , 0 , 1 ])
8381
84- concatted_index = pd . concat ([df1 , df2 ], axis = "index" )
82+ concatted_index = concat ([df1 , df2 ], axis = "index" )
8583 tm .assert_frame_equal (concatted_index , expected_index )
8684
87- concatted_row = pd . concat ([df1 , df2 ], axis = "rows" )
85+ concatted_row = concat ([df1 , df2 ], axis = "rows" )
8886 tm .assert_frame_equal (concatted_row , expected_index )
8987
90- concatted_0 = pd . concat ([df1 , df2 ], axis = 0 )
88+ concatted_0 = concat ([df1 , df2 ], axis = 0 )
9189 tm .assert_frame_equal (concatted_0 , expected_index )
9290
9391 # Columns/1 DataFrame
9492 expected_columns = DataFrame (
9593 [[0.1 , 0.3 ], [0.2 , 0.4 ]], index = [0 , 1 ], columns = ["A" , "A" ]
9694 )
9795
98- concatted_columns = pd . concat ([df1 , df2 ], axis = "columns" )
96+ concatted_columns = concat ([df1 , df2 ], axis = "columns" )
9997 tm .assert_frame_equal (concatted_columns , expected_columns )
10098
101- concatted_1 = pd . concat ([df1 , df2 ], axis = 1 )
99+ concatted_1 = concat ([df1 , df2 ], axis = 1 )
102100 tm .assert_frame_equal (concatted_1 , expected_columns )
103101
104102 series1 = Series ([0.1 , 0.2 ])
@@ -107,29 +105,29 @@ def test_concat_axis_parameter(self):
107105 # Index/row/0 Series
108106 expected_index_series = Series ([0.1 , 0.2 , 0.3 , 0.4 ], index = [0 , 1 , 0 , 1 ])
109107
110- concatted_index_series = pd . concat ([series1 , series2 ], axis = "index" )
108+ concatted_index_series = concat ([series1 , series2 ], axis = "index" )
111109 tm .assert_series_equal (concatted_index_series , expected_index_series )
112110
113- concatted_row_series = pd . concat ([series1 , series2 ], axis = "rows" )
111+ concatted_row_series = concat ([series1 , series2 ], axis = "rows" )
114112 tm .assert_series_equal (concatted_row_series , expected_index_series )
115113
116- concatted_0_series = pd . concat ([series1 , series2 ], axis = 0 )
114+ concatted_0_series = concat ([series1 , series2 ], axis = 0 )
117115 tm .assert_series_equal (concatted_0_series , expected_index_series )
118116
119117 # Columns/1 Series
120118 expected_columns_series = DataFrame (
121119 [[0.1 , 0.3 ], [0.2 , 0.4 ]], index = [0 , 1 ], columns = [0 , 1 ]
122120 )
123121
124- concatted_columns_series = pd . concat ([series1 , series2 ], axis = "columns" )
122+ concatted_columns_series = concat ([series1 , series2 ], axis = "columns" )
125123 tm .assert_frame_equal (concatted_columns_series , expected_columns_series )
126124
127- concatted_1_series = pd . concat ([series1 , series2 ], axis = 1 )
125+ concatted_1_series = concat ([series1 , series2 ], axis = 1 )
128126 tm .assert_frame_equal (concatted_1_series , expected_columns_series )
129127
130128 # Testing ValueError
131129 with pytest .raises (ValueError , match = "No axis named" ):
132- pd . concat ([series1 , series2 ], axis = "something" )
130+ concat ([series1 , series2 ], axis = "something" )
133131
134132 def test_concat_numerical_names (self ):
135133 # GH#15262, GH#12223
@@ -142,7 +140,7 @@ def test_concat_numerical_names(self):
142140 )
143141 ),
144142 )
145- result = pd . concat ((df .iloc [:2 , :], df .iloc [- 2 :, :]))
143+ result = concat ((df .iloc [:2 , :], df .iloc [- 2 :, :]))
146144 expected = DataFrame (
147145 {"col" : [0 , 1 , 7 , 8 ]},
148146 dtype = "int32" ,
@@ -155,7 +153,7 @@ def test_concat_numerical_names(self):
155153 def test_concat_astype_dup_col (self ):
156154 # GH#23049
157155 df = DataFrame ([{"a" : "b" }])
158- df = pd . concat ([df , df ], axis = 1 )
156+ df = concat ([df , df ], axis = 1 )
159157
160158 result = df .astype ("category" )
161159 expected = DataFrame (
0 commit comments