Skip to content

Commit 29cf5f6

Browse files
committed
Review (jreback)
1 parent c6ab972 commit 29cf5f6

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

pandas/core/frame.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6536,9 +6536,10 @@ def _join_compat(self, other, on=None, how='left', lsuffix='', rsuffix='',
65366536
# join indexes only using concat
65376537
if can_concat:
65386538
if how == 'left':
6539-
how = 'outer'
6540-
return concat(frames, axis=1, join=how,
6541-
verify_integrity=True).reindex(self.index)
6539+
res = concat(frames, axis=1, join='outer',
6540+
verify_integrity=True, copy=False)
6541+
res = res.reindex(self.index, copy=False)
6542+
return res
65426543
else:
65436544
return concat(frames, axis=1, join=how,
65446545
verify_integrity=True)

pandas/core/generic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8930,7 +8930,8 @@ def describe_1d(data):
89308930
if name not in names:
89318931
names.append(name)
89328932

8933-
d = pd.concat([x.reindex(names) for x in ldesc], axis=1, sort=False)
8933+
d = pd.concat([x.reindex(names) for x in ldesc], axis=1,
8934+
sort=False, copy=False)
89348935
d.columns = data.columns.copy()
89358936
return d
89368937

pandas/core/groupby/generic.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,11 @@ def _transform_general(self, func, *args, **kwargs):
518518
applied.append(res)
519519

520520
concat_index = obj.columns if self.axis == 0 else obj.index
521-
other_axis = (self.axis + 1) % 2 # switches from 0 to 1 or from 1 to 0
521+
other_axis = 1 if self.axis == 0 else 0 # switches between 0 & 1
522522
concatenated = concat(applied, axis=self.axis,
523-
verify_integrity=False).reindex(concat_index,
524-
axis=other_axis)
523+
verify_integrity=False, copy=False)
524+
concatenated = concatenated.reindex(concat_index, axis=other_axis,
525+
copy=False)
525526
return self._set_result_index_ordered(concatenated)
526527

527528
@Substitution(klass='DataFrame', selected='')

pandas/core/reshape/concat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ def concat(objs, axis=0, join='outer', join_axes=None, ignore_index=False,
223223
if join_axes is not None:
224224
warnings.warn('The join_axes-keyword is deprecated. Use .reindex or '
225225
'.reindex_like on the result to achieve the same '
226-
'functionality, or apply those methods to the inputs if '
227-
'performance-sensitive.', FutureWarning, stacklevel=2)
226+
'functionality.', FutureWarning, stacklevel=2)
228227
op = _Concatenator(objs, axis=axis, join_axes=join_axes,
229228
ignore_index=ignore_index, join=join,
230229
keys=keys, levels=levels, names=names,

pandas/tests/reshape/test_concat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,8 @@ def test_concat_categorical_empty(self):
729729
tm.assert_series_equal(pd.concat([s2, s1], ignore_index=True), exp)
730730
tm.assert_series_equal(s2.append(s1, ignore_index=True), exp)
731731

732-
def test_concat_join_axes(self, axis):
732+
def test_concat_join_axes_deprecated(self, axis):
733+
# GH21951
733734
one = pd.DataFrame([[0., 1.], [2., 3.]], columns=list('ab'))
734735
two = pd.DataFrame([[10., 11.], [12., 13.]], index=[1, 2],
735736
columns=list('bc'))

0 commit comments

Comments
 (0)