Skip to content

Commit b4867df

Browse files
committed
BUG: GH13194 fixed
1 parent 4e4a7d9 commit b4867df

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

doc/source/whatsnew/v0.17.1.txt

+1
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,4 @@ Bug Fixes
202202
- Bug in ``DataFrame.to_sparse()`` loses column names for MultiIndexes (:issue:`11600`)
203203
- Bug in ``DataFrame.round()`` with non-unique column index producing a Fatal Python error (:issue:`11611`)
204204
- Bug in ``DataFrame.round()`` with ``decimals`` being a non-unique indexed Series producing extra columns (:issue:`11618`)
205+
- Fixed the bug in ``DataFrame.align()`` which was giving wrong output when supplied with the ``join`` argument. (:issue:`13194`)

pandas/core/generic.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4153,7 +4153,8 @@ def align(self, other, join='outer', axis=None, level=None, copy=True,
41534153
# self
41544154
cons = self._constructor_expanddim
41554155
df = cons(dict((c, self) for c in other.columns),
4156-
**other._construct_axes_dict())
4156+
**self._construct_axes_dict(
4157+
**other._construct_axes_dict(axes=['columns'])))
41574158
return df._align_frame(other, join=join, axis=axis,
41584159
level=level, copy=copy,
41594160
fill_value=fill_value, method=method,
@@ -4163,7 +4164,8 @@ def align(self, other, join='outer', axis=None, level=None, copy=True,
41634164
# other
41644165
cons = other._constructor_expanddim
41654166
df = cons(dict((c, other) for c in self.columns),
4166-
**self._construct_axes_dict())
4167+
**other._construct_axes_dict(
4168+
**self._construct_axes_dict(axes=['columns'])))
41674169
return self._align_frame(df, join=join, axis=axis, level=level,
41684170
copy=copy, fill_value=fill_value,
41694171
method=method, limit=limit,

0 commit comments

Comments
 (0)