diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index 2e3098d94afcb..871e329f49e76 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -1328,6 +1328,13 @@ def _slice_take_blocks_ax0( ] return blocks else: + warnings.warn( + "In a future version, indexing along columns will " + "always return a view, never a copy. " + "To restore the previous behavior, use result.copy() " + "instead of result", + FutureWarning, + ) return [ blk.take_nd( slobj, @@ -1390,6 +1397,13 @@ def _slice_take_blocks_ax0( nb = blk.getitem_block([i], new_mgr_locs=ml) blocks.append(nb) else: + warnings.warn( + "In a future version, indexing along columns will " + "always return a view, never a copy. " + "To restore the previous behavior, use result.copy() " + "instead of result", + FutureWarning, + ) nb = blk.take_nd(taker, axis=0, new_mgr_locs=mgr_locs) blocks.append(nb)