Skip to content

Commit 5294371

Browse files
committed
Review (jreback)
1 parent d9122d4 commit 5294371

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
@@ -6507,9 +6507,10 @@ def _join_compat(self, other, on=None, how='left', lsuffix='', rsuffix='',
65076507
# join indexes only using concat
65086508
if can_concat:
65096509
if how == 'left':
6510-
how = 'outer'
6511-
return concat(frames, axis=1, join=how,
6512-
verify_integrity=True).reindex(self.index)
6510+
res = concat(frames, axis=1, join='outer',
6511+
verify_integrity=True, copy=False)
6512+
res = res.reindex(self.index, copy=False)
6513+
return res
65136514
else:
65146515
return concat(frames, axis=1, join=how,
65156516
verify_integrity=True)

pandas/core/generic.py

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

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

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)