diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index 0ceac8aeb9db8..0d5b96439843c 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -993,7 +993,7 @@ Indexing - Bug in :meth:`DataFrame.sum` min_count changes dtype if input contains NaNs (:issue:`46947`) - Bug in :class:`IntervalTree` that lead to an infinite recursion. (:issue:`46658`) - Bug in :class:`PeriodIndex` raising ``AttributeError`` when indexing on ``NA``, rather than putting ``NaT`` in its place. (:issue:`46673`) -- +- Bug in :meth:`DataFrame.dropna` where a copy of the dataframe was not returned if rows are dropped (:issue:`39448`) Missing ^^^^^^^ diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 7a4f41da5840c..c7aa3f7da6f3c 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -6546,7 +6546,7 @@ def dropna( if np.all(mask): result = self.copy() else: - result = self.loc(axis=axis)[mask] + result = self.loc(axis=axis)[mask].copy() if not inplace: return result