-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Adding docstrings to functions #15580 #52774
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
Changes from all commits
3218cfb
17061d9
6530480
bf21068
149cb80
bee8c9e
fa883f8
bc09ea0
448f19c
03dce2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,70 @@ | |
|
||
|
||
def using_copy_on_write() -> bool: | ||
""" | ||
Determine if copy-on-write mode is being used. | ||
|
||
This function examines the global pandas configuration settings. | ||
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. | ||
|
||
Parameters | ||
---------- | ||
None | ||
|
||
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.chained_assignment', 'raise') | ||
>>> pd.set_option('mode.copy', True) | ||
>>> pd.set_option('mode.use_inf_as_na', True) | ||
>>> pd.set_option('compute.use_bottleneck', False) | ||
>>> pd.set_option('compute.use_numexpr', False) | ||
>>> using_copy_on_write() | ||
True | ||
Comment on lines
+54
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's a couple of issues here:
How about we just put something like
(I haven't tried running this, so the syntax might not be correct) |
||
""" | ||
_mode_options = _global_config["mode"] | ||
return _mode_options["copy_on_write"] and _mode_options["data_manager"] == "block" | ||
|
||
|
||
def using_nullable_dtypes() -> bool: | ||
""" | ||
Determine if nullable data types are being used. | ||
|
||
This function reads the `mode` configuration option from the global | ||
configuration object and indicate whether nullable data types are allowed. | ||
|
||
Parameters | ||
---------- | ||
None | ||
|
||
Returns | ||
------- | ||
bool | ||
'True' if pandas is using nullable data types, otherwise 'False'. | ||
|
||
Example | ||
------- | ||
>>> pd.set_option('mode.use_inf_as_na', True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we remove this one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do! |
||
>>> pd.set_option('mode.use_nullable_dtypes', True) | ||
>>> using_nullable_dtypes() | ||
True | ||
>>> pd.set_option('mode.use_nullable_dtypes', False) | ||
>>> using_nullable_dtypes() | ||
False | ||
|
||
Notes | ||
----- | ||
This function assumes that the global pandas configuration settings have | ||
already been initialized. If you are not sure whether the settings | ||
have been initialized, you can call the | ||
pandas.api.types.is_extension_type() function to force initialization. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My mistake, it doesn't initialize or make changes for that matter on the Settings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's |
||
""" | ||
_mode_options = _global_config["mode"] | ||
return _mode_options["nullable_dtypes"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used elsewhere in the docs? if not, I think we can just leave the
parameters
section outThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!