diff --git a/pandas/core/config_init.py b/pandas/core/config_init.py index a8b63f97141c2..050bce873d31a 100644 --- a/pandas/core/config_init.py +++ b/pandas/core/config_init.py @@ -476,9 +476,7 @@ def use_inf_as_na_cb(key) -> None: "copy_on_write", # Get the default from an environment variable, if set, otherwise defaults # to False. This environment variable can be set for testing. - "warn" - if os.environ.get("PANDAS_COPY_ON_WRITE", "0") == "warn" - else os.environ.get("PANDAS_COPY_ON_WRITE", "0") == "1", + True, copy_on_write_doc, validator=is_one_of_factory([True, False, "warn"]), )