From 2834bbb2146a20112b9c34a6089a9748f04ed337 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Sun, 26 Nov 2023 01:04:31 +0100 Subject: [PATCH] Fix warnings for inplace ops --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index e4e95a973a3c1..7b48e9137fd8d 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -12450,7 +12450,7 @@ def _inplace_method(self, other, op) -> Self: """ warn = True if not PYPY and warn_copy_on_write(): - if sys.getrefcount(self) <= 4: + if sys.getrefcount(self) <= REF_COUNT * 2: # we are probably in an inplace setitem context (e.g. df['a'] += 1) warn = False