Skip to content

DOC: Adding Docstring to using_copy_on_write #15580 #53151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pandas/_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@


def using_copy_on_write() -> bool:
"""
Determine if copy-on-write mode is enabled.

Copy-on-write is a memory-saving technique that avoids copying data
until it is actually modified, which can be particularly useful when
working with large datasets.

Returns
-------
bool
'True' if copy-on-write mode is enabled and the data manager
is set to "block", otherwise 'False'.

Example
-------
>>> pd.set_option("mode.copy_on_write", True)
>>> using_copy_on_write()
True
>>> pd.set_option("mode.copy_on_write", False)
>>> using_copy_on_write()
False
"""
_mode_options = _global_config["mode"]
return _mode_options["copy_on_write"] and _mode_options["data_manager"] == "block"

Expand Down