repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
pandas-dev/pandas | pandas/core/generic.py | NDFrame.swaplevel | def swaplevel(self, i=-2, j=-1, axis=0):
"""
Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : ... | python | def swaplevel(self, i=-2, j=-1, axis=0):
"""
Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : ... | [
"def",
"swaplevel",
"(",
"self",
",",
"i",
"=",
"-",
"2",
",",
"j",
"=",
"-",
"1",
",",
"axis",
"=",
"0",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"result",
"=",
"self",
".",
"copy",
"(",
")",
"labels",
"=",
"... | Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : same type as caller (new object)
.. versionchanged::... | [
"Swap",
"levels",
"i",
"and",
"j",
"in",
"a",
"MultiIndex",
"on",
"a",
"particular",
"axis"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L943-L965 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.rename | def rename(self, *args, **kwargs):
"""
Alter axes input function or functions. Function / dict values must be
unique (1-to-1). Labels not contained in a dict / Series will be left
as-is. Extra labels listed don't throw an error. Alternatively, change
``Series.name`` with a scalar... | python | def rename(self, *args, **kwargs):
"""
Alter axes input function or functions. Function / dict values must be
unique (1-to-1). Labels not contained in a dict / Series will be left
as-is. Extra labels listed don't throw an error. Alternatively, change
``Series.name`` with a scalar... | [
"def",
"rename",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"args",
",",
"kwargs",
")",
"copy",
"=",
"kwargs",
".",
"pop",
"(",
"'copy'",
",",
"Tru... | Alter axes input function or functions. Function / dict values must be
unique (1-to-1). Labels not contained in a dict / Series will be left
as-is. Extra labels listed don't throw an error. Alternatively, change
``Series.name`` with a scalar value (Series only).
Parameters
-----... | [
"Alter",
"axes",
"input",
"function",
"or",
"functions",
".",
"Function",
"/",
"dict",
"values",
"must",
"be",
"unique",
"(",
"1",
"-",
"to",
"-",
"1",
")",
".",
"Labels",
"not",
"contained",
"in",
"a",
"dict",
"/",
"Series",
"will",
"be",
"left",
"a... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L970-L1129 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.rename_axis | def rename_axis(self, mapper=sentinel, **kwargs):
"""
Set the name of the axis for the index or columns.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function... | python | def rename_axis(self, mapper=sentinel, **kwargs):
"""
Set the name of the axis for the index or columns.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function... | [
"def",
"rename_axis",
"(",
"self",
",",
"mapper",
"=",
"sentinel",
",",
"*",
"*",
"kwargs",
")",
":",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"(",
")",
",",
"kwargs",
",",
"sentinel",
"=",
"sentinel",
")",
"copy",
... | Set the name of the axis for the index or columns.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function, optional
A scalar, list-like, dict-like or functions tra... | [
"Set",
"the",
"name",
"of",
"the",
"axis",
"for",
"the",
"index",
"or",
"columns",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1133-L1312 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._set_axis_name | def _set_axis_name(self, name, axis=0, inplace=False):
"""
Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'ind... | python | def _set_axis_name(self, name, axis=0, inplace=False):
"""
Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'ind... | [
"def",
"_set_axis_name",
"(",
"self",
",",
"name",
",",
"axis",
"=",
"0",
",",
"inplace",
"=",
"False",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"idx",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
")",
".",
"set_names"... | Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'index' specifies index,
and the value 1 or 'columns' specifies col... | [
"Set",
"the",
"name",
"(",
"s",
")",
"of",
"the",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1314-L1373 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.equals | def equals(self, other):
"""
Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against
each other to see if they have the same shape and elements. NaNs in
the same location are considered equal. The column headers do... | python | def equals(self, other):
"""
Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against
each other to see if they have the same shape and elements. NaNs in
the same location are considered equal. The column headers do... | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"_constructor",
")",
":",
"return",
"False",
"return",
"self",
".",
"_data",
".",
"equals",
"(",
"other",
".",
"_data",
")"
] | Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against
each other to see if they have the same shape and elements. NaNs in
the same location are considered equal. The column headers do not
need to have the same type, but ... | [
"Test",
"whether",
"two",
"objects",
"contain",
"the",
"same",
"elements",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1382-L1466 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.bool | def bool(self):
"""
Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean
"""
v = self.squeeze()
... | python | def bool(self):
"""
Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean
"""
v = self.squeeze()
... | [
"def",
"bool",
"(",
"self",
")",
":",
"v",
"=",
"self",
".",
"squeeze",
"(",
")",
"if",
"isinstance",
"(",
"v",
",",
"(",
"bool",
",",
"np",
".",
"bool_",
")",
")",
":",
"return",
"bool",
"(",
"v",
")",
"elif",
"is_scalar",
"(",
"v",
")",
":"... | Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean | [
"Return",
"the",
"bool",
"of",
"a",
"single",
"element",
"PandasObject",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1514-L1529 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._is_level_reference | def _is_level_reference(self, key, axis=0):
"""
Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1)... | python | def _is_level_reference(self, key, axis=0):
"""
Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1)... | [
"def",
"_is_level_reference",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_level_reference is... | Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1): Matches the name of a column level and does NOT match
... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1545-L1576 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._is_label_reference | def _is_label_reference(self, key, axis=0):
"""
Test whether a key is a label reference for a given axis.
To be considered a label reference, `key` must be a string that:
- (axis=0): Matches a column label
- (axis=1): Matches an index label
Parameters
------... | python | def _is_label_reference(self, key, axis=0):
"""
Test whether a key is a label reference for a given axis.
To be considered a label reference, `key` must be a string that:
- (axis=0): Matches a column label
- (axis=1): Matches an index label
Parameters
------... | [
"def",
"_is_label_reference",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_label_reference is not implemented for {type}\"",
".",
"format",
"(",
"type",
"=",
"ty... | Test whether a key is a label reference for a given axis.
To be considered a label reference, `key` must be a string that:
- (axis=0): Matches a column label
- (axis=1): Matches an index label
Parameters
----------
key: str
Potential label name
a... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"reference",
"for",
"a",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1578-L1608 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._is_label_or_level_reference | def _is_label_or_level_reference(self, key, axis=0):
"""
Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis... | python | def _is_label_or_level_reference(self, key, axis=0):
"""
Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis... | [
"def",
"_is_label_or_level_reference",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_label_or_level_reference is not implemented for {type}\"",
".",
"format",
"(",
"t... | Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis=1): Matches an index label or a column level
Parameters
... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"or",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1610-L1637 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._check_label_or_level_ambiguity | def _check_label_or_level_ambiguity(self, key, axis=0):
"""
Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key: str or object
label or leve... | python | def _check_label_or_level_ambiguity(self, key, axis=0):
"""
Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key: str or object
label or leve... | [
"def",
"_check_label_or_level_ambiguity",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_check_label_or_level_ambiguity is not implemented for {type}\"",
".",
"format",
"("... | Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key: str or object
label or level name
axis: int, default 0
Axis that levels are associa... | [
"Check",
"whether",
"key",
"is",
"ambiguous",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1639-L1686 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._get_label_or_level_values | def _get_label_or_level_values(self, key, axis=0):
"""
Return a 1-D array of values associated with `key`, a label or level
from the given `axis`.
Retrieval logic:
- (axis=0): Return column values if `key` matches a column label.
Otherwise return index level values... | python | def _get_label_or_level_values(self, key, axis=0):
"""
Return a 1-D array of values associated with `key`, a label or level
from the given `axis`.
Retrieval logic:
- (axis=0): Return column values if `key` matches a column label.
Otherwise return index level values... | [
"def",
"_get_label_or_level_values",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_get_label_or_level_values is not implemented for {type}\"",
".",
"format",
"(",
"type"... | Return a 1-D array of values associated with `key`, a label or level
from the given `axis`.
Retrieval logic:
- (axis=0): Return column values if `key` matches a column label.
Otherwise return index level values if `key` matches an index
level.
- (axis=1): Ret... | [
"Return",
"a",
"1",
"-",
"D",
"array",
"of",
"values",
"associated",
"with",
"key",
"a",
"label",
"or",
"level",
"from",
"the",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1688-L1757 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._drop_labels_or_levels | def _drop_labels_or_levels(self, keys, axis=0):
"""
Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If... | python | def _drop_labels_or_levels(self, keys, axis=0):
"""
Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If... | [
"def",
"_drop_labels_or_levels",
"(",
"self",
",",
"keys",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_drop_labels_or_levels is not implemented for {type}\"",
".",
"format",
"(",
"type",
"="... | Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If key matches an index label then drop the row.
Otherwise... | [
"Drop",
"labels",
"and",
"/",
"or",
"levels",
"for",
"the",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1759-L1838 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.empty | def empty(self):
"""
Indicator whether DataFrame is empty.
True if DataFrame is entirely empty (no items), meaning any of the
axes are of length 0.
Returns
-------
bool
If DataFrame is empty, return True, if not return False.
See Also
... | python | def empty(self):
"""
Indicator whether DataFrame is empty.
True if DataFrame is entirely empty (no items), meaning any of the
axes are of length 0.
Returns
-------
bool
If DataFrame is empty, return True, if not return False.
See Also
... | [
"def",
"empty",
"(",
"self",
")",
":",
"return",
"any",
"(",
"len",
"(",
"self",
".",
"_get_axis",
"(",
"a",
")",
")",
"==",
"0",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
")"
] | Indicator whether DataFrame is empty.
True if DataFrame is entirely empty (no items), meaning any of the
axes are of length 0.
Returns
-------
bool
If DataFrame is empty, return True, if not return False.
See Also
--------
Series.dropna
... | [
"Indicator",
"whether",
"DataFrame",
"is",
"empty",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1878-L1924 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._repr_data_resource_ | def _repr_data_resource_(self):
"""
Not a real Jupyter special repr method, but we use the same
naming convention.
"""
if config.get_option("display.html.table_schema"):
data = self.head(config.get_option('display.max_rows'))
payload = json.loads(data.to_j... | python | def _repr_data_resource_(self):
"""
Not a real Jupyter special repr method, but we use the same
naming convention.
"""
if config.get_option("display.html.table_schema"):
data = self.head(config.get_option('display.max_rows'))
payload = json.loads(data.to_j... | [
"def",
"_repr_data_resource_",
"(",
"self",
")",
":",
"if",
"config",
".",
"get_option",
"(",
"\"display.html.table_schema\"",
")",
":",
"data",
"=",
"self",
".",
"head",
"(",
"config",
".",
"get_option",
"(",
"'display.max_rows'",
")",
")",
"payload",
"=",
... | Not a real Jupyter special repr method, but we use the same
naming convention. | [
"Not",
"a",
"real",
"Jupyter",
"special",
"repr",
"method",
"but",
"we",
"use",
"the",
"same",
"naming",
"convention",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2021-L2030 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_json | def to_json(self, path_or_buf=None, orient=None, date_format=None,
double_precision=10, force_ascii=True, date_unit='ms',
default_handler=None, lines=False, compression='infer',
index=True):
"""
Convert the object to a JSON string.
Note NaN's and ... | python | def to_json(self, path_or_buf=None, orient=None, date_format=None,
double_precision=10, force_ascii=True, date_unit='ms',
default_handler=None, lines=False, compression='infer',
index=True):
"""
Convert the object to a JSON string.
Note NaN's and ... | [
"def",
"to_json",
"(",
"self",
",",
"path_or_buf",
"=",
"None",
",",
"orient",
"=",
"None",
",",
"date_format",
"=",
"None",
",",
"double_precision",
"=",
"10",
",",
"force_ascii",
"=",
"True",
",",
"date_unit",
"=",
"'ms'",
",",
"default_handler",
"=",
... | Convert the object to a JSON string.
Note NaN's and None will be converted to null and datetime objects
will be converted to UNIX timestamps.
Parameters
----------
path_or_buf : string or file handle, optional
File path or object. If not specified, the result is ret... | [
"Convert",
"the",
"object",
"to",
"a",
"JSON",
"string",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2158-L2302 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_hdf | def to_hdf(self, path_or_buf, key, **kwargs):
"""
Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an
application to interpret the structure and contents of a file with
no outside information. One HDF file can h... | python | def to_hdf(self, path_or_buf, key, **kwargs):
"""
Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an
application to interpret the structure and contents of a file with
no outside information. One HDF file can h... | [
"def",
"to_hdf",
"(",
"self",
",",
"path_or_buf",
",",
"key",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"pytables",
"return",
"pytables",
".",
"to_hdf",
"(",
"path_or_buf",
",",
"key",
",",
"self",
",",
"*",
"*",
"kwar... | Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an
application to interpret the structure and contents of a file with
no outside information. One HDF file can hold a mix of related objects
which can be accessed as a gr... | [
"Write",
"the",
"contained",
"data",
"to",
"an",
"HDF5",
"file",
"using",
"HDFStore",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2304-L2406 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_msgpack | def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs):
"""
Serialize object to input file path using msgpack format.
THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Parameters
----------
path : string... | python | def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs):
"""
Serialize object to input file path using msgpack format.
THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Parameters
----------
path : string... | [
"def",
"to_msgpack",
"(",
"self",
",",
"path_or_buf",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"packers",
"return",
"packers",
".",
"to_msgpack",
"(",
"path_or_buf",
",",
"sel... | Serialize object to input file path using msgpack format.
THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Parameters
----------
path : string File path, buffer-like, or None
if None, return generated string
ap... | [
"Serialize",
"object",
"to",
"input",
"file",
"path",
"using",
"msgpack",
"format",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2408-L2427 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_sql | def to_sql(self, name, con, schema=None, if_exists='fail', index=True,
index_label=None, chunksize=None, dtype=None, method=None):
"""
Write records stored in a DataFrame to a SQL database.
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created,... | python | def to_sql(self, name, con, schema=None, if_exists='fail', index=True,
index_label=None, chunksize=None, dtype=None, method=None):
"""
Write records stored in a DataFrame to a SQL database.
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created,... | [
"def",
"to_sql",
"(",
"self",
",",
"name",
",",
"con",
",",
"schema",
"=",
"None",
",",
"if_exists",
"=",
"'fail'",
",",
"index",
"=",
"True",
",",
"index_label",
"=",
"None",
",",
"chunksize",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"method",
... | Write records stored in a DataFrame to a SQL database.
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created, appended to, or overwritten.
Parameters
----------
name : string
Name of SQL table.
con : sqlalchemy.engine.Engine or sq... | [
"Write",
"records",
"stored",
"in",
"a",
"DataFrame",
"to",
"a",
"SQL",
"database",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2429-L2560 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_pickle | def to_pickle(self, path, compression='infer',
protocol=pickle.HIGHEST_PROTOCOL):
"""
Pickle (serialize) object to file.
Parameters
----------
path : str
File path where the pickled object will be stored.
compression : {'infer', 'gzip', 'bz2... | python | def to_pickle(self, path, compression='infer',
protocol=pickle.HIGHEST_PROTOCOL):
"""
Pickle (serialize) object to file.
Parameters
----------
path : str
File path where the pickled object will be stored.
compression : {'infer', 'gzip', 'bz2... | [
"def",
"to_pickle",
"(",
"self",
",",
"path",
",",
"compression",
"=",
"'infer'",
",",
"protocol",
"=",
"pickle",
".",
"HIGHEST_PROTOCOL",
")",
":",
"from",
"pandas",
".",
"io",
".",
"pickle",
"import",
"to_pickle",
"return",
"to_pickle",
"(",
"self",
",",... | Pickle (serialize) object to file.
Parameters
----------
path : str
File path where the pickled object will be stored.
compression : {'infer', 'gzip', 'bz2', 'zip', 'xz', None}, \
default 'infer'
A string representing the compression to use in the output ... | [
"Pickle",
"(",
"serialize",
")",
"object",
"to",
"file",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2562-L2619 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_clipboard | def to_clipboard(self, excel=True, sep=None, **kwargs):
r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
... | python | def to_clipboard(self, excel=True, sep=None, **kwargs):
r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
... | [
"def",
"to_clipboard",
"(",
"self",
",",
"excel",
"=",
"True",
",",
"sep",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"clipboards",
"clipboards",
".",
"to_clipboard",
"(",
"self",
",",
"excel",
"=",
"excel",
... | r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
- True, use the provided separator, writing in a csv format ... | [
"r",
"Copy",
"object",
"to",
"the",
"system",
"clipboard",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2621-L2676 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_xarray | def to_xarray(self):
"""
Return an xarray object from the pandas object.
Returns
-------
xarray.DataArray or xarray.Dataset
Data in the pandas structure converted to Dataset if the object is
a DataFrame, or a DataArray if the object is a Series.
... | python | def to_xarray(self):
"""
Return an xarray object from the pandas object.
Returns
-------
xarray.DataArray or xarray.Dataset
Data in the pandas structure converted to Dataset if the object is
a DataFrame, or a DataArray if the object is a Series.
... | [
"def",
"to_xarray",
"(",
"self",
")",
":",
"try",
":",
"import",
"xarray",
"except",
"ImportError",
":",
"# Give a nice error message",
"raise",
"ImportError",
"(",
"\"the xarray library is not installed\\n\"",
"\"you can install via conda\\n\"",
"\"conda install xarray\\n\"",
... | Return an xarray object from the pandas object.
Returns
-------
xarray.DataArray or xarray.Dataset
Data in the pandas structure converted to Dataset if the object is
a DataFrame, or a DataArray if the object is a Series.
See Also
--------
DataFra... | [
"Return",
"an",
"xarray",
"object",
"from",
"the",
"pandas",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2678-L2773 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_latex | def to_latex(self, buf=None, columns=None, col_space=None, header=True,
index=True, na_rep='NaN', formatters=None, float_format=None,
sparsify=None, index_names=True, bold_rows=False,
column_format=None, longtable=None, escape=None,
encoding=None, deci... | python | def to_latex(self, buf=None, columns=None, col_space=None, header=True,
index=True, na_rep='NaN', formatters=None, float_format=None,
sparsify=None, index_names=True, bold_rows=False,
column_format=None, longtable=None, escape=None,
encoding=None, deci... | [
"def",
"to_latex",
"(",
"self",
",",
"buf",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"col_space",
"=",
"None",
",",
"header",
"=",
"True",
",",
"index",
"=",
"True",
",",
"na_rep",
"=",
"'NaN'",
",",
"formatters",
"=",
"None",
",",
"float_forma... | r"""
Render an object to a LaTeX tabular environment table.
Render an object to a tabular environment table. You can splice
this into a LaTeX document. Requires \usepackage{booktabs}.
.. versionchanged:: 0.20.2
Added to Series
Parameters
----------
b... | [
"r",
"Render",
"an",
"object",
"to",
"a",
"LaTeX",
"tabular",
"environment",
"table",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2775-L2910 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_csv | def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
columns=None, header=True, index=True, index_label=None,
mode='w', encoding=None, compression='infer', quoting=None,
quotechar='"', line_terminator=None, chunksize=None,
tupleize_cols=No... | python | def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
columns=None, header=True, index=True, index_label=None,
mode='w', encoding=None, compression='infer', quoting=None,
quotechar='"', line_terminator=None, chunksize=None,
tupleize_cols=No... | [
"def",
"to_csv",
"(",
"self",
",",
"path_or_buf",
"=",
"None",
",",
"sep",
"=",
"\",\"",
",",
"na_rep",
"=",
"''",
",",
"float_format",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"header",
"=",
"True",
",",
"index",
"=",
"True",
",",
"index_label... | r"""
Write object to a comma-separated values (csv) file.
.. versionchanged:: 0.24.0
The order of arguments for Series was changed.
Parameters
----------
path_or_buf : str or file handle, default None
File path or object, if None is provided the result i... | [
"r",
"Write",
"object",
"to",
"a",
"comma",
"-",
"separated",
"values",
"(",
"csv",
")",
"file",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2912-L3053 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._create_indexer | def _create_indexer(cls, name, indexer):
"""Create an indexer like _name in the class."""
if getattr(cls, name, None) is None:
_indexer = functools.partial(indexer, name)
setattr(cls, name, property(_indexer, doc=indexer.__doc__)) | python | def _create_indexer(cls, name, indexer):
"""Create an indexer like _name in the class."""
if getattr(cls, name, None) is None:
_indexer = functools.partial(indexer, name)
setattr(cls, name, property(_indexer, doc=indexer.__doc__)) | [
"def",
"_create_indexer",
"(",
"cls",
",",
"name",
",",
"indexer",
")",
":",
"if",
"getattr",
"(",
"cls",
",",
"name",
",",
"None",
")",
"is",
"None",
":",
"_indexer",
"=",
"functools",
".",
"partial",
"(",
"indexer",
",",
"name",
")",
"setattr",
"("... | Create an indexer like _name in the class. | [
"Create",
"an",
"indexer",
"like",
"_name",
"in",
"the",
"class",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3059-L3063 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.get | def get(self, key, default=None):
"""
Get item from object for given key (DataFrame column, Panel slice,
etc.). Returns default value if not found.
Parameters
----------
key : object
Returns
-------
value : same type as items contained in object
... | python | def get(self, key, default=None):
"""
Get item from object for given key (DataFrame column, Panel slice,
etc.). Returns default value if not found.
Parameters
----------
key : object
Returns
-------
value : same type as items contained in object
... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
"[",
"key",
"]",
"except",
"(",
"KeyError",
",",
"ValueError",
",",
"IndexError",
")",
":",
"return",
"default"
] | Get item from object for given key (DataFrame column, Panel slice,
etc.). Returns default value if not found.
Parameters
----------
key : object
Returns
-------
value : same type as items contained in object | [
"Get",
"item",
"from",
"object",
"for",
"given",
"key",
"(",
"DataFrame",
"column",
"Panel",
"slice",
"etc",
".",
")",
".",
"Returns",
"default",
"value",
"if",
"not",
"found",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3065-L3081 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._get_item_cache | def _get_item_cache(self, item):
"""Return the cached item, item represents a label indexer."""
cache = self._item_cache
res = cache.get(item)
if res is None:
values = self._data.get(item)
res = self._box_item_values(item, values)
cache[item] = res
... | python | def _get_item_cache(self, item):
"""Return the cached item, item represents a label indexer."""
cache = self._item_cache
res = cache.get(item)
if res is None:
values = self._data.get(item)
res = self._box_item_values(item, values)
cache[item] = res
... | [
"def",
"_get_item_cache",
"(",
"self",
",",
"item",
")",
":",
"cache",
"=",
"self",
".",
"_item_cache",
"res",
"=",
"cache",
".",
"get",
"(",
"item",
")",
"if",
"res",
"is",
"None",
":",
"values",
"=",
"self",
".",
"_data",
".",
"get",
"(",
"item",... | Return the cached item, item represents a label indexer. | [
"Return",
"the",
"cached",
"item",
"item",
"represents",
"a",
"label",
"indexer",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3086-L3098 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._set_as_cached | def _set_as_cached(self, item, cacher):
"""Set the _cacher attribute on the calling object with a weakref to
cacher.
"""
self._cacher = (item, weakref.ref(cacher)) | python | def _set_as_cached(self, item, cacher):
"""Set the _cacher attribute on the calling object with a weakref to
cacher.
"""
self._cacher = (item, weakref.ref(cacher)) | [
"def",
"_set_as_cached",
"(",
"self",
",",
"item",
",",
"cacher",
")",
":",
"self",
".",
"_cacher",
"=",
"(",
"item",
",",
"weakref",
".",
"ref",
"(",
"cacher",
")",
")"
] | Set the _cacher attribute on the calling object with a weakref to
cacher. | [
"Set",
"the",
"_cacher",
"attribute",
"on",
"the",
"calling",
"object",
"with",
"a",
"weakref",
"to",
"cacher",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3100-L3104 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._iget_item_cache | def _iget_item_cache(self, item):
"""Return the cached item, item represents a positional indexer."""
ax = self._info_axis
if ax.is_unique:
lower = self._get_item_cache(ax[item])
else:
lower = self._take(item, axis=self._info_axis_number)
return lower | python | def _iget_item_cache(self, item):
"""Return the cached item, item represents a positional indexer."""
ax = self._info_axis
if ax.is_unique:
lower = self._get_item_cache(ax[item])
else:
lower = self._take(item, axis=self._info_axis_number)
return lower | [
"def",
"_iget_item_cache",
"(",
"self",
",",
"item",
")",
":",
"ax",
"=",
"self",
".",
"_info_axis",
"if",
"ax",
".",
"is_unique",
":",
"lower",
"=",
"self",
".",
"_get_item_cache",
"(",
"ax",
"[",
"item",
"]",
")",
"else",
":",
"lower",
"=",
"self",... | Return the cached item, item represents a positional indexer. | [
"Return",
"the",
"cached",
"item",
"item",
"represents",
"a",
"positional",
"indexer",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3111-L3118 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._maybe_update_cacher | def _maybe_update_cacher(self, clear=False, verify_is_copy=True):
"""
See if we need to update our parent cacher if clear, then clear our
cache.
Parameters
----------
clear : boolean, default False
clear the item cache
verify_is_copy : boolean, defaul... | python | def _maybe_update_cacher(self, clear=False, verify_is_copy=True):
"""
See if we need to update our parent cacher if clear, then clear our
cache.
Parameters
----------
clear : boolean, default False
clear the item cache
verify_is_copy : boolean, defaul... | [
"def",
"_maybe_update_cacher",
"(",
"self",
",",
"clear",
"=",
"False",
",",
"verify_is_copy",
"=",
"True",
")",
":",
"cacher",
"=",
"getattr",
"(",
"self",
",",
"'_cacher'",
",",
"None",
")",
"if",
"cacher",
"is",
"not",
"None",
":",
"ref",
"=",
"cach... | See if we need to update our parent cacher if clear, then clear our
cache.
Parameters
----------
clear : boolean, default False
clear the item cache
verify_is_copy : boolean, default True
provide is_copy checks | [
"See",
"if",
"we",
"need",
"to",
"update",
"our",
"parent",
"cacher",
"if",
"clear",
"then",
"clear",
"our",
"cache",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3145-L3177 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._slice | def _slice(self, slobj, axis=0, kind=None):
"""
Construct a slice of this container.
kind parameter is maintained for compatibility with Series slicing.
"""
axis = self._get_block_manager_axis(axis)
result = self._constructor(self._data.get_slice(slobj, axis=axis))
... | python | def _slice(self, slobj, axis=0, kind=None):
"""
Construct a slice of this container.
kind parameter is maintained for compatibility with Series slicing.
"""
axis = self._get_block_manager_axis(axis)
result = self._constructor(self._data.get_slice(slobj, axis=axis))
... | [
"def",
"_slice",
"(",
"self",
",",
"slobj",
",",
"axis",
"=",
"0",
",",
"kind",
"=",
"None",
")",
":",
"axis",
"=",
"self",
".",
"_get_block_manager_axis",
"(",
"axis",
")",
"result",
"=",
"self",
".",
"_constructor",
"(",
"self",
".",
"_data",
".",
... | Construct a slice of this container.
kind parameter is maintained for compatibility with Series slicing. | [
"Construct",
"a",
"slice",
"of",
"this",
"container",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3185-L3199 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._check_is_chained_assignment_possible | def _check_is_chained_assignment_possible(self):
"""
Check if we are a view, have a cacher, and are of mixed type.
If so, then force a setitem_copy check.
Should be called just near setting a value
Will return a boolean if it we are a view and are cached, but a
single-d... | python | def _check_is_chained_assignment_possible(self):
"""
Check if we are a view, have a cacher, and are of mixed type.
If so, then force a setitem_copy check.
Should be called just near setting a value
Will return a boolean if it we are a view and are cached, but a
single-d... | [
"def",
"_check_is_chained_assignment_possible",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_view",
"and",
"self",
".",
"_is_cached",
":",
"ref",
"=",
"self",
".",
"_get_cacher",
"(",
")",
"if",
"ref",
"is",
"not",
"None",
"and",
"ref",
".",
"_is_mixed_t... | Check if we are a view, have a cacher, and are of mixed type.
If so, then force a setitem_copy check.
Should be called just near setting a value
Will return a boolean if it we are a view and are cached, but a
single-dtype meaning that the cacher should be updated following
sett... | [
"Check",
"if",
"we",
"are",
"a",
"view",
"have",
"a",
"cacher",
"and",
"are",
"of",
"mixed",
"type",
".",
"If",
"so",
"then",
"force",
"a",
"setitem_copy",
"check",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3214-L3233 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._take | def _take(self, indices, axis=0, is_copy=True):
"""
Return the elements in the given *positional* indices along an axis.
This means that we are not indexing according to actual values in
the index attribute of the object. We are indexing according to the
actual position of the e... | python | def _take(self, indices, axis=0, is_copy=True):
"""
Return the elements in the given *positional* indices along an axis.
This means that we are not indexing according to actual values in
the index attribute of the object. We are indexing according to the
actual position of the e... | [
"def",
"_take",
"(",
"self",
",",
"indices",
",",
"axis",
"=",
"0",
",",
"is_copy",
"=",
"True",
")",
":",
"self",
".",
"_consolidate_inplace",
"(",
")",
"new_data",
"=",
"self",
".",
"_data",
".",
"take",
"(",
"indices",
",",
"axis",
"=",
"self",
... | Return the elements in the given *positional* indices along an axis.
This means that we are not indexing according to actual values in
the index attribute of the object. We are indexing according to the
actual position of the element in the object.
This is the internal version of ``.ta... | [
"Return",
"the",
"elements",
"in",
"the",
"given",
"*",
"positional",
"*",
"indices",
"along",
"an",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3353-L3397 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.take | def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
"""
Return the elements in the given *positional* indices along an axis.
This means that we are not indexing according to actual values in
the index attribute of the object. We are indexing according to the
a... | python | def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
"""
Return the elements in the given *positional* indices along an axis.
This means that we are not indexing according to actual values in
the index attribute of the object. We are indexing according to the
a... | [
"def",
"take",
"(",
"self",
",",
"indices",
",",
"axis",
"=",
"0",
",",
"convert",
"=",
"None",
",",
"is_copy",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"convert",
"is",
"not",
"None",
":",
"msg",
"=",
"(",
"\"The 'convert' parameter is ... | Return the elements in the given *positional* indices along an axis.
This means that we are not indexing according to actual values in
the index attribute of the object. We are indexing according to the
actual position of the element in the object.
Parameters
----------
... | [
"Return",
"the",
"elements",
"in",
"the",
"given",
"*",
"positional",
"*",
"indices",
"along",
"an",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3399-L3489 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.xs | def xs(self, key, axis=0, level=None, drop_level=True):
"""
Return cross-section from the Series/DataFrame.
This method takes a `key` argument to select data at a particular
level of a MultiIndex.
Parameters
----------
key : label or tuple of label
L... | python | def xs(self, key, axis=0, level=None, drop_level=True):
"""
Return cross-section from the Series/DataFrame.
This method takes a `key` argument to select data at a particular
level of a MultiIndex.
Parameters
----------
key : label or tuple of label
L... | [
"def",
"xs",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"drop_level",
"=",
"True",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"labels",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
... | Return cross-section from the Series/DataFrame.
This method takes a `key` argument to select data at a particular
level of a MultiIndex.
Parameters
----------
key : label or tuple of label
Label contained in the index, or partially in a MultiIndex.
axis : {0... | [
"Return",
"cross",
"-",
"section",
"from",
"the",
"Series",
"/",
"DataFrame",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3491-L3649 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.select | def select(self, crit, axis=0):
"""
Return data corresponding to axis labels matching criteria.
.. deprecated:: 0.21.0
Use df.loc[df.index.map(crit)] to select via labels
Parameters
----------
crit : function
To be called on each index (label). S... | python | def select(self, crit, axis=0):
"""
Return data corresponding to axis labels matching criteria.
.. deprecated:: 0.21.0
Use df.loc[df.index.map(crit)] to select via labels
Parameters
----------
crit : function
To be called on each index (label). S... | [
"def",
"select",
"(",
"self",
",",
"crit",
",",
"axis",
"=",
"0",
")",
":",
"warnings",
".",
"warn",
"(",
"\"'select' is deprecated and will be removed in a \"",
"\"future release. You can use \"",
"\".loc[labels.map(crit)] as a replacement\"",
",",
"FutureWarning",
",",
... | Return data corresponding to axis labels matching criteria.
.. deprecated:: 0.21.0
Use df.loc[df.index.map(crit)] to select via labels
Parameters
----------
crit : function
To be called on each index (label). Should return True or False
axis : int
... | [
"Return",
"data",
"corresponding",
"to",
"axis",
"labels",
"matching",
"criteria",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3653-L3685 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.reindex_like | def reindex_like(self, other, method=None, copy=True, limit=None,
tolerance=None):
"""
Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional
filling logic, placing NaN in locations having no value
... | python | def reindex_like(self, other, method=None, copy=True, limit=None,
tolerance=None):
"""
Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional
filling logic, placing NaN in locations having no value
... | [
"def",
"reindex_like",
"(",
"self",
",",
"other",
",",
"method",
"=",
"None",
",",
"copy",
"=",
"True",
",",
"limit",
"=",
"None",
",",
"tolerance",
"=",
"None",
")",
":",
"d",
"=",
"other",
".",
"_construct_axes_dict",
"(",
"axes",
"=",
"self",
".",... | Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional
filling logic, placing NaN in locations having no value
in the previous index. A new object is produced unless the
new index is equivalent to the current one and copy=False... | [
"Return",
"an",
"object",
"with",
"matching",
"indices",
"as",
"other",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3687-L3787 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._drop_axis | def _drop_axis(self, labels, axis, level=None, errors='raise'):
"""
Drop labels from specified axis. Used in the ``drop`` method
internally.
Parameters
----------
labels : single label or list-like
axis : int or axis name
level : int or level name, defaul... | python | def _drop_axis(self, labels, axis, level=None, errors='raise'):
"""
Drop labels from specified axis. Used in the ``drop`` method
internally.
Parameters
----------
labels : single label or list-like
axis : int or axis name
level : int or level name, defaul... | [
"def",
"_drop_axis",
"(",
"self",
",",
"labels",
",",
"axis",
",",
"level",
"=",
"None",
",",
"errors",
"=",
"'raise'",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"axis_name",
"=",
"self",
".",
"_get_axis_name",
"(",
"axi... | Drop labels from specified axis. Used in the ``drop`` method
internally.
Parameters
----------
labels : single label or list-like
axis : int or axis name
level : int or level name, default None
For MultiIndex
errors : {'ignore', 'raise'}, default 'rai... | [
"Drop",
"labels",
"from",
"specified",
"axis",
".",
"Used",
"in",
"the",
"drop",
"method",
"internally",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3817-L3868 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._update_inplace | def _update_inplace(self, result, verify_is_copy=True):
"""
Replace self internals with result.
Parameters
----------
verify_is_copy : boolean, default True
provide is_copy checks
"""
# NOTE: This does *not* call __finalize__ and that's an explicit
... | python | def _update_inplace(self, result, verify_is_copy=True):
"""
Replace self internals with result.
Parameters
----------
verify_is_copy : boolean, default True
provide is_copy checks
"""
# NOTE: This does *not* call __finalize__ and that's an explicit
... | [
"def",
"_update_inplace",
"(",
"self",
",",
"result",
",",
"verify_is_copy",
"=",
"True",
")",
":",
"# NOTE: This does *not* call __finalize__ and that's an explicit",
"# decision that we may revisit in the future.",
"self",
".",
"_reset_cache",
"(",
")",
"self",
".",
"_cle... | Replace self internals with result.
Parameters
----------
verify_is_copy : boolean, default True
provide is_copy checks | [
"Replace",
"self",
"internals",
"with",
"result",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3870-L3886 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.add_prefix | def add_prefix(self, prefix):
"""
Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
... | python | def add_prefix(self, prefix):
"""
Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
... | [
"def",
"add_prefix",
"(",
"self",
",",
"prefix",
")",
":",
"f",
"=",
"functools",
".",
"partial",
"(",
"'{prefix}{}'",
".",
"format",
",",
"prefix",
"=",
"prefix",
")",
"mapper",
"=",
"{",
"self",
".",
"_info_axis_name",
":",
"f",
"}",
"return",
"self"... | Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
-------
Series or DataFrame
... | [
"Prefix",
"labels",
"with",
"string",
"prefix",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3888-L3945 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.add_suffix | def add_suffix(self, suffix):
"""
Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
Returns
... | python | def add_suffix(self, suffix):
"""
Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
Returns
... | [
"def",
"add_suffix",
"(",
"self",
",",
"suffix",
")",
":",
"f",
"=",
"functools",
".",
"partial",
"(",
"'{}{suffix}'",
".",
"format",
",",
"suffix",
"=",
"suffix",
")",
"mapper",
"=",
"{",
"self",
".",
"_info_axis_name",
":",
"f",
"}",
"return",
"self"... | Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
Returns
-------
Series or DataFrame
... | [
"Suffix",
"labels",
"with",
"string",
"suffix",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3947-L4004 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.sort_values | def sort_values(self, by=None, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
"""
Sort by the values along either axis.
Parameters
----------%(optional_by)s
axis : %(axes_single_arg)s, default 0
Axis to be sorted.
... | python | def sort_values(self, by=None, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
"""
Sort by the values along either axis.
Parameters
----------%(optional_by)s
axis : %(axes_single_arg)s, default 0
Axis to be sorted.
... | [
"def",
"sort_values",
"(",
"self",
",",
"by",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"ascending",
"=",
"True",
",",
"inplace",
"=",
"False",
",",
"kind",
"=",
"'quicksort'",
",",
"na_position",
"=",
"'last'",
")",
":",
"raise",
"NotImplementedError",
... | Sort by the values along either axis.
Parameters
----------%(optional_by)s
axis : %(axes_single_arg)s, default 0
Axis to be sorted.
ascending : bool or list of bool, default True
Sort ascending vs. descending. Specify list for multiple sort
orders.... | [
"Sort",
"by",
"the",
"values",
"along",
"either",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4006-L4096 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.sort_index | def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
kind='quicksort', na_position='last', sort_remaining=True):
"""
Sort object by labels (along an axis).
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
Th... | python | def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
kind='quicksort', na_position='last', sort_remaining=True):
"""
Sort object by labels (along an axis).
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
Th... | [
"def",
"sort_index",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"ascending",
"=",
"True",
",",
"inplace",
"=",
"False",
",",
"kind",
"=",
"'quicksort'",
",",
"na_position",
"=",
"'last'",
",",
"sort_remaining",
"=",
"True",
")"... | Sort object by labels (along an axis).
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis along which to sort. The value 0 identifies the rows,
and 1 identifies the columns.
level : int or level name or list of ints or list of level ... | [
"Sort",
"object",
"by",
"labels",
"(",
"along",
"an",
"axis",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4098-L4146 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.reindex | def reindex(self, *args, **kwargs):
"""
Conform %(klass)s to new index with optional filling logic, placing
NA/NaN in locations having no value in the previous index. A new object
is produced unless the new index is equivalent to the current one and
``copy=False``.
Param... | python | def reindex(self, *args, **kwargs):
"""
Conform %(klass)s to new index with optional filling logic, placing
NA/NaN in locations having no value in the previous index. A new object
is produced unless the new index is equivalent to the current one and
``copy=False``.
Param... | [
"def",
"reindex",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: Decide if we care about having different examples for different",
"# kinds",
"# construct the args",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"... | Conform %(klass)s to new index with optional filling logic, placing
NA/NaN in locations having no value in the previous index. A new object
is produced unless the new index is equivalent to the current one and
``copy=False``.
Parameters
----------
%(optional_labels)s
... | [
"Conform",
"%",
"(",
"klass",
")",
"s",
"to",
"new",
"index",
"with",
"optional",
"filling",
"logic",
"placing",
"NA",
"/",
"NaN",
"in",
"locations",
"having",
"no",
"value",
"in",
"the",
"previous",
"index",
".",
"A",
"new",
"object",
"is",
"produced",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4148-L4391 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._reindex_axes | def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,
copy):
"""Perform the reindex for all the axes."""
obj = self
for a in self._AXIS_ORDERS:
labels = axes[a]
if labels is None:
continue
ax = self._... | python | def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,
copy):
"""Perform the reindex for all the axes."""
obj = self
for a in self._AXIS_ORDERS:
labels = axes[a]
if labels is None:
continue
ax = self._... | [
"def",
"_reindex_axes",
"(",
"self",
",",
"axes",
",",
"level",
",",
"limit",
",",
"tolerance",
",",
"method",
",",
"fill_value",
",",
"copy",
")",
":",
"obj",
"=",
"self",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
":",
"labels",
"=",
"axes",
"[... | Perform the reindex for all the axes. | [
"Perform",
"the",
"reindex",
"for",
"all",
"the",
"axes",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4393-L4411 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._needs_reindex_multi | def _needs_reindex_multi(self, axes, method, level):
"""Check if we do need a multi reindex."""
return ((com.count_not_none(*axes.values()) == self._AXIS_LEN) and
method is None and level is None and not self._is_mixed_type) | python | def _needs_reindex_multi(self, axes, method, level):
"""Check if we do need a multi reindex."""
return ((com.count_not_none(*axes.values()) == self._AXIS_LEN) and
method is None and level is None and not self._is_mixed_type) | [
"def",
"_needs_reindex_multi",
"(",
"self",
",",
"axes",
",",
"method",
",",
"level",
")",
":",
"return",
"(",
"(",
"com",
".",
"count_not_none",
"(",
"*",
"axes",
".",
"values",
"(",
")",
")",
"==",
"self",
".",
"_AXIS_LEN",
")",
"and",
"method",
"i... | Check if we do need a multi reindex. | [
"Check",
"if",
"we",
"do",
"need",
"a",
"multi",
"reindex",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4413-L4416 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._reindex_with_indexers | def _reindex_with_indexers(self, reindexers, fill_value=None, copy=False,
allow_dups=False):
"""allow_dups indicates an internal call here """
# reindex doing multiple operations on different axes if indicated
new_data = self._data
for axis in sorted(reind... | python | def _reindex_with_indexers(self, reindexers, fill_value=None, copy=False,
allow_dups=False):
"""allow_dups indicates an internal call here """
# reindex doing multiple operations on different axes if indicated
new_data = self._data
for axis in sorted(reind... | [
"def",
"_reindex_with_indexers",
"(",
"self",
",",
"reindexers",
",",
"fill_value",
"=",
"None",
",",
"copy",
"=",
"False",
",",
"allow_dups",
"=",
"False",
")",
":",
"# reindex doing multiple operations on different axes if indicated",
"new_data",
"=",
"self",
".",
... | allow_dups indicates an internal call here | [
"allow_dups",
"indicates",
"an",
"internal",
"call",
"here"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4504-L4530 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.filter | def filter(self, items=None, like=None, regex=None, axis=None):
"""
Subset rows or columns of dataframe according to labels in
the specified index.
Note that this routine does not filter a dataframe on its
contents. The filter is applied to the labels of the index.
Para... | python | def filter(self, items=None, like=None, regex=None, axis=None):
"""
Subset rows or columns of dataframe according to labels in
the specified index.
Note that this routine does not filter a dataframe on its
contents. The filter is applied to the labels of the index.
Para... | [
"def",
"filter",
"(",
"self",
",",
"items",
"=",
"None",
",",
"like",
"=",
"None",
",",
"regex",
"=",
"None",
",",
"axis",
"=",
"None",
")",
":",
"import",
"re",
"nkw",
"=",
"com",
".",
"count_not_none",
"(",
"items",
",",
"like",
",",
"regex",
"... | Subset rows or columns of dataframe according to labels in
the specified index.
Note that this routine does not filter a dataframe on its
contents. The filter is applied to the labels of the index.
Parameters
----------
items : list-like
Keep labels from axi... | [
"Subset",
"rows",
"or",
"columns",
"of",
"dataframe",
"according",
"to",
"labels",
"in",
"the",
"specified",
"index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4532-L4618 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.sample | def sample(self, n=None, frac=None, replace=False, weights=None,
random_state=None, axis=None):
"""
Return a random sample of items from an axis of object.
You can use `random_state` for reproducibility.
Parameters
----------
n : int, optional
... | python | def sample(self, n=None, frac=None, replace=False, weights=None,
random_state=None, axis=None):
"""
Return a random sample of items from an axis of object.
You can use `random_state` for reproducibility.
Parameters
----------
n : int, optional
... | [
"def",
"sample",
"(",
"self",
",",
"n",
"=",
"None",
",",
"frac",
"=",
"None",
",",
"replace",
"=",
"False",
",",
"weights",
"=",
"None",
",",
"random_state",
"=",
"None",
",",
"axis",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis... | Return a random sample of items from an axis of object.
You can use `random_state` for reproducibility.
Parameters
----------
n : int, optional
Number of items from axis to return. Cannot be used with `frac`.
Default = 1 if `frac` = None.
frac : float, o... | [
"Return",
"a",
"random",
"sample",
"of",
"items",
"from",
"an",
"axis",
"of",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4740-L4901 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._dir_additions | def _dir_additions(self):
""" add the string-like attributes from the info_axis.
If info_axis is a MultiIndex, it's first level values are used.
"""
additions = {c for c in self._info_axis.unique(level=0)[:100]
if isinstance(c, str) and c.isidentifier()}
retu... | python | def _dir_additions(self):
""" add the string-like attributes from the info_axis.
If info_axis is a MultiIndex, it's first level values are used.
"""
additions = {c for c in self._info_axis.unique(level=0)[:100]
if isinstance(c, str) and c.isidentifier()}
retu... | [
"def",
"_dir_additions",
"(",
"self",
")",
":",
"additions",
"=",
"{",
"c",
"for",
"c",
"in",
"self",
".",
"_info_axis",
".",
"unique",
"(",
"level",
"=",
"0",
")",
"[",
":",
"100",
"]",
"if",
"isinstance",
"(",
"c",
",",
"str",
")",
"and",
"c",
... | add the string-like attributes from the info_axis.
If info_axis is a MultiIndex, it's first level values are used. | [
"add",
"the",
"string",
"-",
"like",
"attributes",
"from",
"the",
"info_axis",
".",
"If",
"info_axis",
"is",
"a",
"MultiIndex",
"it",
"s",
"first",
"level",
"values",
"are",
"used",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5141-L5147 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._protect_consolidate | def _protect_consolidate(self, f):
"""Consolidate _data -- if the blocks have changed, then clear the
cache
"""
blocks_before = len(self._data.blocks)
result = f()
if len(self._data.blocks) != blocks_before:
self._clear_item_cache()
return result | python | def _protect_consolidate(self, f):
"""Consolidate _data -- if the blocks have changed, then clear the
cache
"""
blocks_before = len(self._data.blocks)
result = f()
if len(self._data.blocks) != blocks_before:
self._clear_item_cache()
return result | [
"def",
"_protect_consolidate",
"(",
"self",
",",
"f",
")",
":",
"blocks_before",
"=",
"len",
"(",
"self",
".",
"_data",
".",
"blocks",
")",
"result",
"=",
"f",
"(",
")",
"if",
"len",
"(",
"self",
".",
"_data",
".",
"blocks",
")",
"!=",
"blocks_before... | Consolidate _data -- if the blocks have changed, then clear the
cache | [
"Consolidate",
"_data",
"--",
"if",
"the",
"blocks",
"have",
"changed",
"then",
"clear",
"the",
"cache"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5155-L5163 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._consolidate_inplace | def _consolidate_inplace(self):
"""Consolidate data in place and return None"""
def f():
self._data = self._data.consolidate()
self._protect_consolidate(f) | python | def _consolidate_inplace(self):
"""Consolidate data in place and return None"""
def f():
self._data = self._data.consolidate()
self._protect_consolidate(f) | [
"def",
"_consolidate_inplace",
"(",
"self",
")",
":",
"def",
"f",
"(",
")",
":",
"self",
".",
"_data",
"=",
"self",
".",
"_data",
".",
"consolidate",
"(",
")",
"self",
".",
"_protect_consolidate",
"(",
"f",
")"
] | Consolidate data in place and return None | [
"Consolidate",
"data",
"in",
"place",
"and",
"return",
"None"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5165-L5171 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._consolidate | def _consolidate(self, inplace=False):
"""
Compute NDFrame with "consolidated" internals (data of each dtype
grouped together in a single ndarray).
Parameters
----------
inplace : boolean, default False
If False return new object, otherwise modify existing ob... | python | def _consolidate(self, inplace=False):
"""
Compute NDFrame with "consolidated" internals (data of each dtype
grouped together in a single ndarray).
Parameters
----------
inplace : boolean, default False
If False return new object, otherwise modify existing ob... | [
"def",
"_consolidate",
"(",
"self",
",",
"inplace",
"=",
"False",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",",
"'inplace'",
")",
"if",
"inplace",
":",
"self",
".",
"_consolidate_inplace",
"(",
")",
"else",
":",
"f",
"=",
"lambda",
... | Compute NDFrame with "consolidated" internals (data of each dtype
grouped together in a single ndarray).
Parameters
----------
inplace : boolean, default False
If False return new object, otherwise modify existing object
Returns
-------
consolidated ... | [
"Compute",
"NDFrame",
"with",
"consolidated",
"internals",
"(",
"data",
"of",
"each",
"dtype",
"grouped",
"together",
"in",
"a",
"single",
"ndarray",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5173-L5193 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._check_inplace_setting | def _check_inplace_setting(self, value):
""" check whether we allow in-place setting with this type of value """
if self._is_mixed_type:
if not self._is_numeric_mixed_type:
# allow an actual np.nan thru
try:
if np.isnan(value):
... | python | def _check_inplace_setting(self, value):
""" check whether we allow in-place setting with this type of value """
if self._is_mixed_type:
if not self._is_numeric_mixed_type:
# allow an actual np.nan thru
try:
if np.isnan(value):
... | [
"def",
"_check_inplace_setting",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_is_mixed_type",
":",
"if",
"not",
"self",
".",
"_is_numeric_mixed_type",
":",
"# allow an actual np.nan thru",
"try",
":",
"if",
"np",
".",
"isnan",
"(",
"value",
")",
... | check whether we allow in-place setting with this type of value | [
"check",
"whether",
"we",
"allow",
"in",
"-",
"place",
"setting",
"with",
"this",
"type",
"of",
"value"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5210-L5226 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.as_matrix | def as_matrix(self, columns=None):
"""
Convert the frame to its Numpy-array representation.
.. deprecated:: 0.23.0
Use :meth:`DataFrame.values` instead.
Parameters
----------
columns : list, optional, default:None
If None, return all columns, oth... | python | def as_matrix(self, columns=None):
"""
Convert the frame to its Numpy-array representation.
.. deprecated:: 0.23.0
Use :meth:`DataFrame.values` instead.
Parameters
----------
columns : list, optional, default:None
If None, return all columns, oth... | [
"def",
"as_matrix",
"(",
"self",
",",
"columns",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Method .as_matrix will be removed in a future version. \"",
"\"Use .values instead.\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
")",
"self",
".",
"_co... | Convert the frame to its Numpy-array representation.
.. deprecated:: 0.23.0
Use :meth:`DataFrame.values` instead.
Parameters
----------
columns : list, optional, default:None
If None, return all columns, otherwise, returns specified columns.
Returns
... | [
"Convert",
"the",
"frame",
"to",
"its",
"Numpy",
"-",
"array",
"representation",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5238-L5281 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.values | def values(self):
"""
Return a Numpy representation of the DataFrame.
.. warning::
We recommend using :meth:`DataFrame.to_numpy` instead.
Only the values in the DataFrame will be returned, the axes labels
will be removed.
Returns
-------
num... | python | def values(self):
"""
Return a Numpy representation of the DataFrame.
.. warning::
We recommend using :meth:`DataFrame.to_numpy` instead.
Only the values in the DataFrame will be returned, the axes labels
will be removed.
Returns
-------
num... | [
"def",
"values",
"(",
"self",
")",
":",
"self",
".",
"_consolidate_inplace",
"(",
")",
"return",
"self",
".",
"_data",
".",
"as_array",
"(",
"transpose",
"=",
"self",
".",
"_AXIS_REVERSED",
")"
] | Return a Numpy representation of the DataFrame.
.. warning::
We recommend using :meth:`DataFrame.to_numpy` instead.
Only the values in the DataFrame will be returned, the axes labels
will be removed.
Returns
-------
numpy.ndarray
The values of t... | [
"Return",
"a",
"Numpy",
"representation",
"of",
"the",
"DataFrame",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5284-L5358 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.get_ftype_counts | def get_ftype_counts(self):
"""
Return counts of unique ftypes in this object.
.. deprecated:: 0.23.0
This is useful for SparseDataFrame or for DataFrames containing
sparse arrays.
Returns
-------
dtype : Series
Series with the count of colu... | python | def get_ftype_counts(self):
"""
Return counts of unique ftypes in this object.
.. deprecated:: 0.23.0
This is useful for SparseDataFrame or for DataFrames containing
sparse arrays.
Returns
-------
dtype : Series
Series with the count of colu... | [
"def",
"get_ftype_counts",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"get_ftype_counts is deprecated and will \"",
"\"be removed in a future version\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
")",
"from",
"pandas",
"import",
"Series",
"return",
... | Return counts of unique ftypes in this object.
.. deprecated:: 0.23.0
This is useful for SparseDataFrame or for DataFrames containing
sparse arrays.
Returns
-------
dtype : Series
Series with the count of columns with each type and
sparsity (den... | [
"Return",
"counts",
"of",
"unique",
"ftypes",
"in",
"this",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5447-L5488 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.dtypes | def dtypes(self):
"""
Return the dtypes in the DataFrame.
This returns a Series with the data type of each column.
The result's index is the original DataFrame's columns. Columns
with mixed types are stored with the ``object`` dtype. See
:ref:`the User Guide <basics.dtyp... | python | def dtypes(self):
"""
Return the dtypes in the DataFrame.
This returns a Series with the data type of each column.
The result's index is the original DataFrame's columns. Columns
with mixed types are stored with the ``object`` dtype. See
:ref:`the User Guide <basics.dtyp... | [
"def",
"dtypes",
"(",
"self",
")",
":",
"from",
"pandas",
"import",
"Series",
"return",
"Series",
"(",
"self",
".",
"_data",
".",
"get_dtypes",
"(",
")",
",",
"index",
"=",
"self",
".",
"_info_axis",
",",
"dtype",
"=",
"np",
".",
"object_",
")"
] | Return the dtypes in the DataFrame.
This returns a Series with the data type of each column.
The result's index is the original DataFrame's columns. Columns
with mixed types are stored with the ``object`` dtype. See
:ref:`the User Guide <basics.dtypes>` for more.
Returns
... | [
"Return",
"the",
"dtypes",
"in",
"the",
"DataFrame",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5491-L5524 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.ftypes | def ftypes(self):
"""
Return the ftypes (indication of sparse/dense and dtype) in DataFrame.
This returns a Series with the data type of each column.
The result's index is the original DataFrame's columns. Columns
with mixed types are stored with the ``object`` dtype. See
... | python | def ftypes(self):
"""
Return the ftypes (indication of sparse/dense and dtype) in DataFrame.
This returns a Series with the data type of each column.
The result's index is the original DataFrame's columns. Columns
with mixed types are stored with the ``object`` dtype. See
... | [
"def",
"ftypes",
"(",
"self",
")",
":",
"from",
"pandas",
"import",
"Series",
"return",
"Series",
"(",
"self",
".",
"_data",
".",
"get_ftypes",
"(",
")",
",",
"index",
"=",
"self",
".",
"_info_axis",
",",
"dtype",
"=",
"np",
".",
"object_",
")"
] | Return the ftypes (indication of sparse/dense and dtype) in DataFrame.
This returns a Series with the data type of each column.
The result's index is the original DataFrame's columns. Columns
with mixed types are stored with the ``object`` dtype. See
:ref:`the User Guide <basics.dtypes... | [
"Return",
"the",
"ftypes",
"(",
"indication",
"of",
"sparse",
"/",
"dense",
"and",
"dtype",
")",
"in",
"DataFrame",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5527-L5570 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.as_blocks | def as_blocks(self, copy=True):
"""
Convert the frame to a dict of dtype -> Constructor Types that each has
a homogeneous dtype.
.. deprecated:: 0.21.0
NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
as_matrix)
Parameters
--------... | python | def as_blocks(self, copy=True):
"""
Convert the frame to a dict of dtype -> Constructor Types that each has
a homogeneous dtype.
.. deprecated:: 0.21.0
NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
as_matrix)
Parameters
--------... | [
"def",
"as_blocks",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"warnings",
".",
"warn",
"(",
"\"as_blocks is deprecated and will \"",
"\"be removed in a future version\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"self",
".",
"_to_di... | Convert the frame to a dict of dtype -> Constructor Types that each has
a homogeneous dtype.
.. deprecated:: 0.21.0
NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
as_matrix)
Parameters
----------
copy : boolean, default True
Ret... | [
"Convert",
"the",
"frame",
"to",
"a",
"dict",
"of",
"dtype",
"-",
">",
"Constructor",
"Types",
"that",
"each",
"has",
"a",
"homogeneous",
"dtype",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5572-L5593 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._to_dict_of_blocks | def _to_dict_of_blocks(self, copy=True):
"""
Return a dict of dtype -> Constructor Types that
each is a homogeneous dtype.
Internal ONLY
"""
return {k: self._constructor(v).__finalize__(self)
for k, v, in self._data.to_dict(copy=copy).items()} | python | def _to_dict_of_blocks(self, copy=True):
"""
Return a dict of dtype -> Constructor Types that
each is a homogeneous dtype.
Internal ONLY
"""
return {k: self._constructor(v).__finalize__(self)
for k, v, in self._data.to_dict(copy=copy).items()} | [
"def",
"_to_dict_of_blocks",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"return",
"{",
"k",
":",
"self",
".",
"_constructor",
"(",
"v",
")",
".",
"__finalize__",
"(",
"self",
")",
"for",
"k",
",",
"v",
",",
"in",
"self",
".",
"_data",
".",
... | Return a dict of dtype -> Constructor Types that
each is a homogeneous dtype.
Internal ONLY | [
"Return",
"a",
"dict",
"of",
"dtype",
"-",
">",
"Constructor",
"Types",
"that",
"each",
"is",
"a",
"homogeneous",
"dtype",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5604-L5612 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.astype | def astype(self, dtype, copy=True, errors='raise', **kwargs):
"""
Cast a pandas object to a specified dtype ``dtype``.
Parameters
----------
dtype : data type, or dict of column name -> data type
Use a numpy.dtype or Python type to cast entire pandas object to
... | python | def astype(self, dtype, copy=True, errors='raise', **kwargs):
"""
Cast a pandas object to a specified dtype ``dtype``.
Parameters
----------
dtype : data type, or dict of column name -> data type
Use a numpy.dtype or Python type to cast entire pandas object to
... | [
"def",
"astype",
"(",
"self",
",",
"dtype",
",",
"copy",
"=",
"True",
",",
"errors",
"=",
"'raise'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"is_dict_like",
"(",
"dtype",
")",
":",
"if",
"self",
".",
"ndim",
"==",
"1",
":",
"# i.e. Series",
"if",
... | Cast a pandas object to a specified dtype ``dtype``.
Parameters
----------
dtype : data type, or dict of column name -> data type
Use a numpy.dtype or Python type to cast entire pandas object to
the same type. Alternatively, use {col: dtype, ...}, where col is a
... | [
"Cast",
"a",
"pandas",
"object",
"to",
"a",
"specified",
"dtype",
"dtype",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5614-L5731 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.copy | def copy(self, deep=True):
"""
Make a copy of this object's indices and data.
When ``deep=True`` (default), a new object will be created with a
copy of the calling object's data and indices. Modifications to
the data or indices of the copy will not be reflected in the
or... | python | def copy(self, deep=True):
"""
Make a copy of this object's indices and data.
When ``deep=True`` (default), a new object will be created with a
copy of the calling object's data and indices. Modifications to
the data or indices of the copy will not be reflected in the
or... | [
"def",
"copy",
"(",
"self",
",",
"deep",
"=",
"True",
")",
":",
"data",
"=",
"self",
".",
"_data",
".",
"copy",
"(",
"deep",
"=",
"deep",
")",
"return",
"self",
".",
"_constructor",
"(",
"data",
")",
".",
"__finalize__",
"(",
"self",
")"
] | Make a copy of this object's indices and data.
When ``deep=True`` (default), a new object will be created with a
copy of the calling object's data and indices. Modifications to
the data or indices of the copy will not be reflected in the
original object (see notes below).
When ... | [
"Make",
"a",
"copy",
"of",
"this",
"object",
"s",
"indices",
"and",
"data",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5733-L5839 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._convert | def _convert(self, datetime=False, numeric=False, timedelta=False,
coerce=False, copy=True):
"""
Attempt to infer better dtype for object columns
Parameters
----------
datetime : boolean, default False
If True, convert to date where possible.
... | python | def _convert(self, datetime=False, numeric=False, timedelta=False,
coerce=False, copy=True):
"""
Attempt to infer better dtype for object columns
Parameters
----------
datetime : boolean, default False
If True, convert to date where possible.
... | [
"def",
"_convert",
"(",
"self",
",",
"datetime",
"=",
"False",
",",
"numeric",
"=",
"False",
",",
"timedelta",
"=",
"False",
",",
"coerce",
"=",
"False",
",",
"copy",
"=",
"True",
")",
":",
"return",
"self",
".",
"_constructor",
"(",
"self",
".",
"_d... | Attempt to infer better dtype for object columns
Parameters
----------
datetime : boolean, default False
If True, convert to date where possible.
numeric : boolean, default False
If True, attempt to convert to numbers (including strings), with
unconve... | [
"Attempt",
"to",
"infer",
"better",
"dtype",
"for",
"object",
"columns"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5855-L5884 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.convert_objects | def convert_objects(self, convert_dates=True, convert_numeric=False,
convert_timedeltas=True, copy=True):
"""
Attempt to infer better dtype for object columns.
.. deprecated:: 0.21.0
Parameters
----------
convert_dates : boolean, default True
... | python | def convert_objects(self, convert_dates=True, convert_numeric=False,
convert_timedeltas=True, copy=True):
"""
Attempt to infer better dtype for object columns.
.. deprecated:: 0.21.0
Parameters
----------
convert_dates : boolean, default True
... | [
"def",
"convert_objects",
"(",
"self",
",",
"convert_dates",
"=",
"True",
",",
"convert_numeric",
"=",
"False",
",",
"convert_timedeltas",
"=",
"True",
",",
"copy",
"=",
"True",
")",
":",
"msg",
"=",
"(",
"\"convert_objects is deprecated. To re-infer data dtypes fo... | Attempt to infer better dtype for object columns.
.. deprecated:: 0.21.0
Parameters
----------
convert_dates : boolean, default True
If True, convert to date where possible. If 'coerce', force
conversion, with unconvertible values becoming NaT.
convert_n... | [
"Attempt",
"to",
"infer",
"better",
"dtype",
"for",
"object",
"columns",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5886-L5930 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.infer_objects | def infer_objects(self):
"""
Attempt to infer better dtypes for object columns.
Attempts soft conversion of object-dtyped
columns, leaving non-object and unconvertible
columns unchanged. The inference rules are the
same as during normal Series/DataFrame construction.
... | python | def infer_objects(self):
"""
Attempt to infer better dtypes for object columns.
Attempts soft conversion of object-dtyped
columns, leaving non-object and unconvertible
columns unchanged. The inference rules are the
same as during normal Series/DataFrame construction.
... | [
"def",
"infer_objects",
"(",
"self",
")",
":",
"# numeric=False necessary to only soft convert;",
"# python objects will still be converted to",
"# native numpy numeric types",
"return",
"self",
".",
"_constructor",
"(",
"self",
".",
"_data",
".",
"convert",
"(",
"datetime",
... | Attempt to infer better dtypes for object columns.
Attempts soft conversion of object-dtyped
columns, leaving non-object and unconvertible
columns unchanged. The inference rules are the
same as during normal Series/DataFrame construction.
.. versionadded:: 0.21.0
Retur... | [
"Attempt",
"to",
"infer",
"better",
"dtypes",
"for",
"object",
"columns",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5932-L5977 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.fillna | def fillna(self, value=None, method=None, axis=None, inplace=False,
limit=None, downcast=None):
"""
Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, dict, Series, or DataFrame
Value to use to fill holes (e.g. 0), alt... | python | def fillna(self, value=None, method=None, axis=None, inplace=False,
limit=None, downcast=None):
"""
Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, dict, Series, or DataFrame
Value to use to fill holes (e.g. 0), alt... | [
"def",
"fillna",
"(",
"self",
",",
"value",
"=",
"None",
",",
"method",
"=",
"None",
",",
"axis",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"limit",
"=",
"None",
",",
"downcast",
"=",
"None",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"("... | Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, dict, Series, or DataFrame
Value to use to fill holes (e.g. 0), alternately a
dict/Series/DataFrame of values specifying which value to use for
each index (for a Series) or c... | [
"Fill",
"NA",
"/",
"NaN",
"values",
"using",
"the",
"specified",
"method",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5982-L6169 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.interpolate | def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
limit_direction='forward', limit_area=None,
downcast=None, **kwargs):
"""
Interpolate values according to different methods.
"""
inplace = validate_bool_kwarg(inplace, 'inpla... | python | def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
limit_direction='forward', limit_area=None,
downcast=None, **kwargs):
"""
Interpolate values according to different methods.
"""
inplace = validate_bool_kwarg(inplace, 'inpla... | [
"def",
"interpolate",
"(",
"self",
",",
"method",
"=",
"'linear'",
",",
"axis",
"=",
"0",
",",
"limit",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"limit_direction",
"=",
"'forward'",
",",
"limit_area",
"=",
"None",
",",
"downcast",
"=",
"None",
"... | Interpolate values according to different methods. | [
"Interpolate",
"values",
"according",
"to",
"different",
"methods",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L6817-L6894 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.asof | def asof(self, where, subset=None):
"""
Return the last row(s) without any NaNs before `where`.
The last row (for each element in `where`, if list) without any
NaN is taken.
In case of a :class:`~pandas.DataFrame`, the last row without NaN
considering only the subset of ... | python | def asof(self, where, subset=None):
"""
Return the last row(s) without any NaNs before `where`.
The last row (for each element in `where`, if list) without any
NaN is taken.
In case of a :class:`~pandas.DataFrame`, the last row without NaN
considering only the subset of ... | [
"def",
"asof",
"(",
"self",
",",
"where",
",",
"subset",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"where",
",",
"str",
")",
":",
"from",
"pandas",
"import",
"to_datetime",
"where",
"=",
"to_datetime",
"(",
"where",
")",
"if",
"not",
"self",
".... | Return the last row(s) without any NaNs before `where`.
The last row (for each element in `where`, if list) without any
NaN is taken.
In case of a :class:`~pandas.DataFrame`, the last row without NaN
considering only the subset of columns (if not `None`)
.. versionadded:: 0.19.... | [
"Return",
"the",
"last",
"row",
"(",
"s",
")",
"without",
"any",
"NaNs",
"before",
"where",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L6899-L7067 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.clip | def clip(self, lower=None, upper=None, axis=None, inplace=False,
*args, **kwargs):
"""
Trim values at input threshold(s).
Assigns values outside boundary to boundary values. Thresholds
can be singular values or array like, and in the latter case
the clipping is perf... | python | def clip(self, lower=None, upper=None, axis=None, inplace=False,
*args, **kwargs):
"""
Trim values at input threshold(s).
Assigns values outside boundary to boundary values. Thresholds
can be singular values or array like, and in the latter case
the clipping is perf... | [
"def",
"clip",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
",",
"axis",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"ABCPanel",
")",
... | Trim values at input threshold(s).
Assigns values outside boundary to boundary values. Thresholds
can be singular values or array like, and in the latter case
the clipping is performed element-wise in the specified axis.
Parameters
----------
lower : float or array_like... | [
"Trim",
"values",
"at",
"input",
"threshold",
"(",
"s",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7256-L7369 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.clip_upper | def clip_upper(self, threshold, axis=None, inplace=False):
"""
Trim values above a given threshold.
.. deprecated:: 0.24.0
Use clip(upper=threshold) instead.
Elements above the `threshold` will be changed to match the
`threshold` value(s). Threshold can be a single ... | python | def clip_upper(self, threshold, axis=None, inplace=False):
"""
Trim values above a given threshold.
.. deprecated:: 0.24.0
Use clip(upper=threshold) instead.
Elements above the `threshold` will be changed to match the
`threshold` value(s). Threshold can be a single ... | [
"def",
"clip_upper",
"(",
"self",
",",
"threshold",
",",
"axis",
"=",
"None",
",",
"inplace",
"=",
"False",
")",
":",
"warnings",
".",
"warn",
"(",
"'clip_upper(threshold) is deprecated, '",
"'use clip(upper=threshold) instead'",
",",
"FutureWarning",
",",
"stacklev... | Trim values above a given threshold.
.. deprecated:: 0.24.0
Use clip(upper=threshold) instead.
Elements above the `threshold` will be changed to match the
`threshold` value(s). Threshold can be a single value or an array,
in the latter case it performs the truncation elemen... | [
"Trim",
"values",
"above",
"a",
"given",
"threshold",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7371-L7449 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.clip_lower | def clip_lower(self, threshold, axis=None, inplace=False):
"""
Trim values below a given threshold.
.. deprecated:: 0.24.0
Use clip(lower=threshold) instead.
Elements below the `threshold` will be changed to match the
`threshold` value(s). Threshold can be a single ... | python | def clip_lower(self, threshold, axis=None, inplace=False):
"""
Trim values below a given threshold.
.. deprecated:: 0.24.0
Use clip(lower=threshold) instead.
Elements below the `threshold` will be changed to match the
`threshold` value(s). Threshold can be a single ... | [
"def",
"clip_lower",
"(",
"self",
",",
"threshold",
",",
"axis",
"=",
"None",
",",
"inplace",
"=",
"False",
")",
":",
"warnings",
".",
"warn",
"(",
"'clip_lower(threshold) is deprecated, '",
"'use clip(lower=threshold) instead'",
",",
"FutureWarning",
",",
"stacklev... | Trim values below a given threshold.
.. deprecated:: 0.24.0
Use clip(lower=threshold) instead.
Elements below the `threshold` will be changed to match the
`threshold` value(s). Threshold can be a single value or an array,
in the latter case it performs the truncation elemen... | [
"Trim",
"values",
"below",
"a",
"given",
"threshold",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7451-L7565 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.groupby | def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True,
group_keys=True, squeeze=False, observed=False, **kwargs):
"""
Group DataFrame or Series using a mapper or by a Series of columns.
A groupby operation involves some combination of splitting the
obje... | python | def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True,
group_keys=True, squeeze=False, observed=False, **kwargs):
"""
Group DataFrame or Series using a mapper or by a Series of columns.
A groupby operation involves some combination of splitting the
obje... | [
"def",
"groupby",
"(",
"self",
",",
"by",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"as_index",
"=",
"True",
",",
"sort",
"=",
"True",
",",
"group_keys",
"=",
"True",
",",
"squeeze",
"=",
"False",
",",
"observed",
"=",
"... | Group DataFrame or Series using a mapper or by a Series of columns.
A groupby operation involves some combination of splitting the
object, applying a function, and combining the results. This can be
used to group large amounts of data and compute operations on these
groups.
Par... | [
"Group",
"DataFrame",
"or",
"Series",
"using",
"a",
"mapper",
"or",
"by",
"a",
"Series",
"of",
"columns",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7567-L7685 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.asfreq | def asfreq(self, freq, method=None, how=None, normalize=False,
fill_value=None):
"""
Convert TimeSeries to specified frequency.
Optionally provide filling method to pad/backfill missing values.
Returns the original data conformed to a new index with the specified
... | python | def asfreq(self, freq, method=None, how=None, normalize=False,
fill_value=None):
"""
Convert TimeSeries to specified frequency.
Optionally provide filling method to pad/backfill missing values.
Returns the original data conformed to a new index with the specified
... | [
"def",
"asfreq",
"(",
"self",
",",
"freq",
",",
"method",
"=",
"None",
",",
"how",
"=",
"None",
",",
"normalize",
"=",
"False",
",",
"fill_value",
"=",
"None",
")",
":",
"from",
"pandas",
".",
"core",
".",
"resample",
"import",
"asfreq",
"return",
"a... | Convert TimeSeries to specified frequency.
Optionally provide filling method to pad/backfill missing values.
Returns the original data conformed to a new index with the specified
frequency. ``resample`` is more appropriate if an operation, such as
summarization, is necessary to represe... | [
"Convert",
"TimeSeries",
"to",
"specified",
"frequency",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7687-L7784 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.at_time | def at_time(self, time, asof=False, axis=None):
"""
Select values at particular time of day (e.g. 9:30AM).
Parameters
----------
time : datetime.time or str
axis : {0 or 'index', 1 or 'columns'}, default 0
.. versionadded:: 0.24.0
Returns
--... | python | def at_time(self, time, asof=False, axis=None):
"""
Select values at particular time of day (e.g. 9:30AM).
Parameters
----------
time : datetime.time or str
axis : {0 or 'index', 1 or 'columns'}, default 0
.. versionadded:: 0.24.0
Returns
--... | [
"def",
"at_time",
"(",
"self",
",",
"time",
",",
"asof",
"=",
"False",
",",
"axis",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"self",
".",
"_stat_axis_number",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",... | Select values at particular time of day (e.g. 9:30AM).
Parameters
----------
time : datetime.time or str
axis : {0 or 'index', 1 or 'columns'}, default 0
.. versionadded:: 0.24.0
Returns
-------
Series or DataFrame
Raises
------
... | [
"Select",
"values",
"at",
"particular",
"time",
"of",
"day",
"(",
"e",
".",
"g",
".",
"9",
":",
"30AM",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7786-L7840 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.between_time | def between_time(self, start_time, end_time, include_start=True,
include_end=True, axis=None):
"""
Select values between particular times of the day (e.g., 9:00-9:30 AM).
By setting ``start_time`` to be later than ``end_time``,
you can get the times that are *not* b... | python | def between_time(self, start_time, end_time, include_start=True,
include_end=True, axis=None):
"""
Select values between particular times of the day (e.g., 9:00-9:30 AM).
By setting ``start_time`` to be later than ``end_time``,
you can get the times that are *not* b... | [
"def",
"between_time",
"(",
"self",
",",
"start_time",
",",
"end_time",
",",
"include_start",
"=",
"True",
",",
"include_end",
"=",
"True",
",",
"axis",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"self",
".",
"_stat_axis_number"... | Select values between particular times of the day (e.g., 9:00-9:30 AM).
By setting ``start_time`` to be later than ``end_time``,
you can get the times that are *not* between the two times.
Parameters
----------
start_time : datetime.time or str
end_time : datetime.time ... | [
"Select",
"values",
"between",
"particular",
"times",
"of",
"the",
"day",
"(",
"e",
".",
"g",
".",
"9",
":",
"00",
"-",
"9",
":",
"30",
"AM",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7842-L7913 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.resample | def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
label=None, convention='start', kind=None, loffset=None,
limit=None, base=0, on=None, level=None):
"""
Resample time-series data.
Convenience method for frequency conversion and resamplin... | python | def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
label=None, convention='start', kind=None, loffset=None,
limit=None, base=0, on=None, level=None):
"""
Resample time-series data.
Convenience method for frequency conversion and resamplin... | [
"def",
"resample",
"(",
"self",
",",
"rule",
",",
"how",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"fill_method",
"=",
"None",
",",
"closed",
"=",
"None",
",",
"label",
"=",
"None",
",",
"convention",
"=",
"'start'",
",",
"kind",
"=",
"None",
",",
... | Resample time-series data.
Convenience method for frequency conversion and resampling of time
series. Object must have a datetime-like index (`DatetimeIndex`,
`PeriodIndex`, or `TimedeltaIndex`), or pass datetime-like values
to the `on` or `level` keyword.
Parameters
--... | [
"Resample",
"time",
"-",
"series",
"data",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7915-L8212 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.first | def first(self, offset):
"""
Convenience method for subsetting initial periods of time series data
based on a date offset.
Parameters
----------
offset : string, DateOffset, dateutil.relativedelta
Returns
-------
subset : same type as caller
... | python | def first(self, offset):
"""
Convenience method for subsetting initial periods of time series data
based on a date offset.
Parameters
----------
offset : string, DateOffset, dateutil.relativedelta
Returns
-------
subset : same type as caller
... | [
"def",
"first",
"(",
"self",
",",
"offset",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"index",
",",
"DatetimeIndex",
")",
":",
"raise",
"TypeError",
"(",
"\"'first' only supports a DatetimeIndex index\"",
")",
"if",
"len",
"(",
"self",
".",
"ind... | Convenience method for subsetting initial periods of time series data
based on a date offset.
Parameters
----------
offset : string, DateOffset, dateutil.relativedelta
Returns
-------
subset : same type as caller
Raises
------
TypeError
... | [
"Convenience",
"method",
"for",
"subsetting",
"initial",
"periods",
"of",
"time",
"series",
"data",
"based",
"on",
"a",
"date",
"offset",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8214-L8275 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.last | def last(self, offset):
"""
Convenience method for subsetting final periods of time series data
based on a date offset.
Parameters
----------
offset : string, DateOffset, dateutil.relativedelta
Returns
-------
subset : same type as caller
... | python | def last(self, offset):
"""
Convenience method for subsetting final periods of time series data
based on a date offset.
Parameters
----------
offset : string, DateOffset, dateutil.relativedelta
Returns
-------
subset : same type as caller
... | [
"def",
"last",
"(",
"self",
",",
"offset",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"index",
",",
"DatetimeIndex",
")",
":",
"raise",
"TypeError",
"(",
"\"'last' only supports a DatetimeIndex index\"",
")",
"if",
"len",
"(",
"self",
".",
"index... | Convenience method for subsetting final periods of time series data
based on a date offset.
Parameters
----------
offset : string, DateOffset, dateutil.relativedelta
Returns
-------
subset : same type as caller
Raises
------
TypeError
... | [
"Convenience",
"method",
"for",
"subsetting",
"final",
"periods",
"of",
"time",
"series",
"data",
"based",
"on",
"a",
"date",
"offset",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8277-L8333 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.rank | def rank(self, axis=0, method='average', numeric_only=None,
na_option='keep', ascending=True, pct=False):
"""
Compute numerical data ranks (1 through n) along axis. Equal values are
assigned a rank that is the average of the ranks of those values.
Parameters
-------... | python | def rank(self, axis=0, method='average', numeric_only=None,
na_option='keep', ascending=True, pct=False):
"""
Compute numerical data ranks (1 through n) along axis. Equal values are
assigned a rank that is the average of the ranks of those values.
Parameters
-------... | [
"def",
"rank",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"method",
"=",
"'average'",
",",
"numeric_only",
"=",
"None",
",",
"na_option",
"=",
"'keep'",
",",
"ascending",
"=",
"True",
",",
"pct",
"=",
"False",
")",
":",
"axis",
"=",
"self",
".",
"_ge... | Compute numerical data ranks (1 through n) along axis. Equal values are
assigned a rank that is the average of the ranks of those values.
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
index to direct ranking
method : {'average', 'min', 'max',... | [
"Compute",
"numerical",
"data",
"ranks",
"(",
"1",
"through",
"n",
")",
"along",
"axis",
".",
"Equal",
"values",
"are",
"assigned",
"a",
"rank",
"that",
"is",
"the",
"average",
"of",
"the",
"ranks",
"of",
"those",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8335-L8397 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._where | def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
errors='raise', try_cast=False):
"""
Equivalent to public method `where`, except that `other` is not
applied as a function even if callable. Used in __setitem__.
"""
inplace = validate_bool_... | python | def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
errors='raise', try_cast=False):
"""
Equivalent to public method `where`, except that `other` is not
applied as a function even if callable. Used in __setitem__.
"""
inplace = validate_bool_... | [
"def",
"_where",
"(",
"self",
",",
"cond",
",",
"other",
"=",
"np",
".",
"nan",
",",
"inplace",
"=",
"False",
",",
"axis",
"=",
"None",
",",
"level",
"=",
"None",
",",
"errors",
"=",
"'raise'",
",",
"try_cast",
"=",
"False",
")",
":",
"inplace",
... | Equivalent to public method `where`, except that `other` is not
applied as a function even if callable. Used in __setitem__. | [
"Equivalent",
"to",
"public",
"method",
"where",
"except",
"that",
"other",
"is",
"not",
"applied",
"as",
"a",
"function",
"even",
"if",
"callable",
".",
"Used",
"in",
"__setitem__",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8609-L8743 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.slice_shift | def slice_shift(self, periods=1, axis=0):
"""
Equivalent to `shift` without copying data. The shifted data will
not include the dropped periods and the shifted axis will be smaller
than the original.
Parameters
----------
periods : int
Number of perio... | python | def slice_shift(self, periods=1, axis=0):
"""
Equivalent to `shift` without copying data. The shifted data will
not include the dropped periods and the shifted axis will be smaller
than the original.
Parameters
----------
periods : int
Number of perio... | [
"def",
"slice_shift",
"(",
"self",
",",
"periods",
"=",
"1",
",",
"axis",
"=",
"0",
")",
":",
"if",
"periods",
"==",
"0",
":",
"return",
"self",
"if",
"periods",
">",
"0",
":",
"vslicer",
"=",
"slice",
"(",
"None",
",",
"-",
"periods",
")",
"isli... | Equivalent to `shift` without copying data. The shifted data will
not include the dropped periods and the shifted axis will be smaller
than the original.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
Returns
... | [
"Equivalent",
"to",
"shift",
"without",
"copying",
"data",
".",
"The",
"shifted",
"data",
"will",
"not",
"include",
"the",
"dropped",
"periods",
"and",
"the",
"shifted",
"axis",
"will",
"be",
"smaller",
"than",
"the",
"original",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9010-L9044 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.tshift | def tshift(self, periods=1, freq=None, axis=0):
"""
Shift the time index, using the index's frequency if available.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
freq : DateOffset, timedelta, or time rule string, d... | python | def tshift(self, periods=1, freq=None, axis=0):
"""
Shift the time index, using the index's frequency if available.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
freq : DateOffset, timedelta, or time rule string, d... | [
"def",
"tshift",
"(",
"self",
",",
"periods",
"=",
"1",
",",
"freq",
"=",
"None",
",",
"axis",
"=",
"0",
")",
":",
"index",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
")",
"if",
"freq",
"is",
"None",
":",
"freq",
"=",
"getattr",
"(",
"index",
... | Shift the time index, using the index's frequency if available.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
freq : DateOffset, timedelta, or time rule string, default None
Increment to use from the tseries module or ... | [
"Shift",
"the",
"time",
"index",
"using",
"the",
"index",
"s",
"frequency",
"if",
"available",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9046-L9101 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.truncate | def truncate(self, before=None, after=None, axis=None, copy=True):
"""
Truncate a Series or DataFrame before and after some index value.
This is a useful shorthand for boolean indexing based on index
values above or below certain thresholds.
Parameters
----------
... | python | def truncate(self, before=None, after=None, axis=None, copy=True):
"""
Truncate a Series or DataFrame before and after some index value.
This is a useful shorthand for boolean indexing based on index
values above or below certain thresholds.
Parameters
----------
... | [
"def",
"truncate",
"(",
"self",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
",",
"axis",
"=",
"None",
",",
"copy",
"=",
"True",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"self",
".",
"_stat_axis_number",
"axis",
"=",
"self"... | Truncate a Series or DataFrame before and after some index value.
This is a useful shorthand for boolean indexing based on index
values above or below certain thresholds.
Parameters
----------
before : date, string, int
Truncate all rows before this index value.
... | [
"Truncate",
"a",
"Series",
"or",
"DataFrame",
"before",
"and",
"after",
"some",
"index",
"value",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9103-L9255 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.tz_convert | def tz_convert(self, tz, axis=0, level=None, copy=True):
"""
Convert tz-aware axis to target time zone.
Parameters
----------
tz : string or pytz.timezone object
axis : the axis to convert
level : int, str, default None
If axis ia a MultiIndex, conver... | python | def tz_convert(self, tz, axis=0, level=None, copy=True):
"""
Convert tz-aware axis to target time zone.
Parameters
----------
tz : string or pytz.timezone object
axis : the axis to convert
level : int, str, default None
If axis ia a MultiIndex, conver... | [
"def",
"tz_convert",
"(",
"self",
",",
"tz",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"copy",
"=",
"True",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"ax",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
"... | Convert tz-aware axis to target time zone.
Parameters
----------
tz : string or pytz.timezone object
axis : the axis to convert
level : int, str, default None
If axis ia a MultiIndex, convert a specific level. Otherwise
must be None
copy : boolean... | [
"Convert",
"tz",
"-",
"aware",
"axis",
"to",
"target",
"time",
"zone",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9257-L9307 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.tz_localize | def tz_localize(self, tz, axis=0, level=None, copy=True,
ambiguous='raise', nonexistent='raise'):
"""
Localize tz-naive index of a Series or DataFrame to target time zone.
This operation localizes the Index. To localize the values in a
timezone-naive Series, use :met... | python | def tz_localize(self, tz, axis=0, level=None, copy=True,
ambiguous='raise', nonexistent='raise'):
"""
Localize tz-naive index of a Series or DataFrame to target time zone.
This operation localizes the Index. To localize the values in a
timezone-naive Series, use :met... | [
"def",
"tz_localize",
"(",
"self",
",",
"tz",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"copy",
"=",
"True",
",",
"ambiguous",
"=",
"'raise'",
",",
"nonexistent",
"=",
"'raise'",
")",
":",
"nonexistent_options",
"=",
"(",
"'raise'",
",",
... | Localize tz-naive index of a Series or DataFrame to target time zone.
This operation localizes the Index. To localize the values in a
timezone-naive Series, use :meth:`Series.dt.tz_localize`.
Parameters
----------
tz : string or pytz.timezone object
axis : the axis to l... | [
"Localize",
"tz",
"-",
"naive",
"index",
"of",
"a",
"Series",
"or",
"DataFrame",
"to",
"target",
"time",
"zone",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9309-L9471 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.describe | def describe(self, percentiles=None, include=None, exclude=None):
"""
Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values.
Analyzes both numeric and object series, as well
as ``Da... | python | def describe(self, percentiles=None, include=None, exclude=None):
"""
Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values.
Analyzes both numeric and object series, as well
as ``Da... | [
"def",
"describe",
"(",
"self",
",",
"percentiles",
"=",
"None",
",",
"include",
"=",
"None",
",",
"exclude",
"=",
"None",
")",
":",
"if",
"self",
".",
"ndim",
">=",
"3",
":",
"msg",
"=",
"\"describe is not implemented on Panel objects.\"",
"raise",
"NotImpl... | Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values.
Analyzes both numeric and object series, as well
as ``DataFrame`` column sets of mixed data types. The output
will vary depending on w... | [
"Generate",
"descriptive",
"statistics",
"that",
"summarize",
"the",
"central",
"tendency",
"dispersion",
"and",
"shape",
"of",
"a",
"dataset",
"s",
"distribution",
"excluding",
"NaN",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9544-L9875 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._check_percentile | def _check_percentile(self, q):
"""
Validate percentiles (used by describe and quantile).
"""
msg = ("percentiles should all be in the interval [0, 1]. "
"Try {0} instead.")
q = np.asarray(q)
if q.ndim == 0:
if not 0 <= q <= 1:
... | python | def _check_percentile(self, q):
"""
Validate percentiles (used by describe and quantile).
"""
msg = ("percentiles should all be in the interval [0, 1]. "
"Try {0} instead.")
q = np.asarray(q)
if q.ndim == 0:
if not 0 <= q <= 1:
... | [
"def",
"_check_percentile",
"(",
"self",
",",
"q",
")",
":",
"msg",
"=",
"(",
"\"percentiles should all be in the interval [0, 1]. \"",
"\"Try {0} instead.\"",
")",
"q",
"=",
"np",
".",
"asarray",
"(",
"q",
")",
"if",
"q",
".",
"ndim",
"==",
"0",
":",
"if",
... | Validate percentiles (used by describe and quantile). | [
"Validate",
"percentiles",
"(",
"used",
"by",
"describe",
"and",
"quantile",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9877-L9891 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._add_numeric_operations | def _add_numeric_operations(cls):
"""
Add the operations to the cls; evaluate the doc strings again
"""
axis_descr, name, name2 = _doc_parms(cls)
cls.any = _make_logical_function(
cls, 'any', name, name2, axis_descr, _any_desc, nanops.nanany,
_any_see_al... | python | def _add_numeric_operations(cls):
"""
Add the operations to the cls; evaluate the doc strings again
"""
axis_descr, name, name2 = _doc_parms(cls)
cls.any = _make_logical_function(
cls, 'any', name, name2, axis_descr, _any_desc, nanops.nanany,
_any_see_al... | [
"def",
"_add_numeric_operations",
"(",
"cls",
")",
":",
"axis_descr",
",",
"name",
",",
"name2",
"=",
"_doc_parms",
"(",
"cls",
")",
"cls",
".",
"any",
"=",
"_make_logical_function",
"(",
"cls",
",",
"'any'",
",",
"name",
",",
"name2",
",",
"axis_descr",
... | Add the operations to the cls; evaluate the doc strings again | [
"Add",
"the",
"operations",
"to",
"the",
"cls",
";",
"evaluate",
"the",
"doc",
"strings",
"again"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10038-L10162 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._add_series_only_operations | def _add_series_only_operations(cls):
"""
Add the series only operations to the cls; evaluate the doc
strings again.
"""
axis_descr, name, name2 = _doc_parms(cls)
def nanptp(values, axis=0, skipna=True):
nmax = nanops.nanmax(values, axis, skipna)
... | python | def _add_series_only_operations(cls):
"""
Add the series only operations to the cls; evaluate the doc
strings again.
"""
axis_descr, name, name2 = _doc_parms(cls)
def nanptp(values, axis=0, skipna=True):
nmax = nanops.nanmax(values, axis, skipna)
... | [
"def",
"_add_series_only_operations",
"(",
"cls",
")",
":",
"axis_descr",
",",
"name",
",",
"name2",
"=",
"_doc_parms",
"(",
"cls",
")",
"def",
"nanptp",
"(",
"values",
",",
"axis",
"=",
"0",
",",
"skipna",
"=",
"True",
")",
":",
"nmax",
"=",
"nanops",... | Add the series only operations to the cls; evaluate the doc
strings again. | [
"Add",
"the",
"series",
"only",
"operations",
"to",
"the",
"cls",
";",
"evaluate",
"the",
"doc",
"strings",
"again",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10165-L10187 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._add_series_or_dataframe_operations | def _add_series_or_dataframe_operations(cls):
"""
Add the series or dataframe only operations to the cls; evaluate
the doc strings again.
"""
from pandas.core import window as rwindow
@Appender(rwindow.rolling.__doc__)
def rolling(self, window, min_periods=None,... | python | def _add_series_or_dataframe_operations(cls):
"""
Add the series or dataframe only operations to the cls; evaluate
the doc strings again.
"""
from pandas.core import window as rwindow
@Appender(rwindow.rolling.__doc__)
def rolling(self, window, min_periods=None,... | [
"def",
"_add_series_or_dataframe_operations",
"(",
"cls",
")",
":",
"from",
"pandas",
".",
"core",
"import",
"window",
"as",
"rwindow",
"@",
"Appender",
"(",
"rwindow",
".",
"rolling",
".",
"__doc__",
")",
"def",
"rolling",
"(",
"self",
",",
"window",
",",
... | Add the series or dataframe only operations to the cls; evaluate
the doc strings again. | [
"Add",
"the",
"series",
"or",
"dataframe",
"only",
"operations",
"to",
"the",
"cls",
";",
"evaluate",
"the",
"doc",
"strings",
"again",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10190-L10226 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._find_valid_index | def _find_valid_index(self, how):
"""
Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
idx_first_valid : type of in... | python | def _find_valid_index(self, how):
"""
Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
idx_first_valid : type of in... | [
"def",
"_find_valid_index",
"(",
"self",
",",
"how",
")",
":",
"assert",
"how",
"in",
"[",
"'first'",
",",
"'last'",
"]",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"# early stop",
"return",
"None",
"is_valid",
"=",
"~",
"self",
".",
"isna",
"(",... | Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
idx_first_valid : type of index | [
"Retrieves",
"the",
"index",
"of",
"the",
"first",
"valid",
"value",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10253-L10286 | train |
pandas-dev/pandas | pandas/core/base.py | PandasObject._reset_cache | def _reset_cache(self, key=None):
"""
Reset cached properties. If ``key`` is passed, only clears that key.
"""
if getattr(self, '_cache', None) is None:
return
if key is None:
self._cache.clear()
else:
self._cache.pop(key, None) | python | def _reset_cache(self, key=None):
"""
Reset cached properties. If ``key`` is passed, only clears that key.
"""
if getattr(self, '_cache', None) is None:
return
if key is None:
self._cache.clear()
else:
self._cache.pop(key, None) | [
"def",
"_reset_cache",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_cache'",
",",
"None",
")",
"is",
"None",
":",
"return",
"if",
"key",
"is",
"None",
":",
"self",
".",
"_cache",
".",
"clear",
"(",
")",
"e... | Reset cached properties. If ``key`` is passed, only clears that key. | [
"Reset",
"cached",
"properties",
".",
"If",
"key",
"is",
"passed",
"only",
"clears",
"that",
"key",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L86-L95 | train |
pandas-dev/pandas | pandas/core/base.py | SelectionMixin._try_aggregate_string_function | def _try_aggregate_string_function(self, arg, *args, **kwargs):
"""
if arg is a string, then try to operate on it:
- try to find a function (or attribute) on ourselves
- try to find a numpy function
- raise
"""
assert isinstance(arg, str)
f = getattr(sel... | python | def _try_aggregate_string_function(self, arg, *args, **kwargs):
"""
if arg is a string, then try to operate on it:
- try to find a function (or attribute) on ourselves
- try to find a numpy function
- raise
"""
assert isinstance(arg, str)
f = getattr(sel... | [
"def",
"_try_aggregate_string_function",
"(",
"self",
",",
"arg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"arg",
",",
"str",
")",
"f",
"=",
"getattr",
"(",
"self",
",",
"arg",
",",
"None",
")",
"if",
"f",
"... | if arg is a string, then try to operate on it:
- try to find a function (or attribute) on ourselves
- try to find a numpy function
- raise | [
"if",
"arg",
"is",
"a",
"string",
"then",
"try",
"to",
"operate",
"on",
"it",
":",
"-",
"try",
"to",
"find",
"a",
"function",
"(",
"or",
"attribute",
")",
"on",
"ourselves",
"-",
"try",
"to",
"find",
"a",
"numpy",
"function",
"-",
"raise"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L285-L311 | train |
pandas-dev/pandas | pandas/core/base.py | SelectionMixin._aggregate | def _aggregate(self, arg, *args, **kwargs):
"""
provide an implementation for the aggregators
Parameters
----------
arg : string, dict, function
*args : args to pass on to the function
**kwargs : kwargs to pass on to the function
Returns
-------
... | python | def _aggregate(self, arg, *args, **kwargs):
"""
provide an implementation for the aggregators
Parameters
----------
arg : string, dict, function
*args : args to pass on to the function
**kwargs : kwargs to pass on to the function
Returns
-------
... | [
"def",
"_aggregate",
"(",
"self",
",",
"arg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"is_aggregator",
"=",
"lambda",
"x",
":",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"tuple",
",",
"dict",
")",
")",
"is_nested_renamer",
"=",
"F... | provide an implementation for the aggregators
Parameters
----------
arg : string, dict, function
*args : args to pass on to the function
**kwargs : kwargs to pass on to the function
Returns
-------
tuple of result, how
Notes
-----
... | [
"provide",
"an",
"implementation",
"for",
"the",
"aggregators"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L313-L553 | train |
pandas-dev/pandas | pandas/core/base.py | SelectionMixin._shallow_copy | def _shallow_copy(self, obj=None, obj_type=None, **kwargs):
"""
return a new object with the replacement attributes
"""
if obj is None:
obj = self._selected_obj.copy()
if obj_type is None:
obj_type = self._constructor
if isinstance(obj, obj_type):
... | python | def _shallow_copy(self, obj=None, obj_type=None, **kwargs):
"""
return a new object with the replacement attributes
"""
if obj is None:
obj = self._selected_obj.copy()
if obj_type is None:
obj_type = self._constructor
if isinstance(obj, obj_type):
... | [
"def",
"_shallow_copy",
"(",
"self",
",",
"obj",
"=",
"None",
",",
"obj_type",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"obj",
"is",
"None",
":",
"obj",
"=",
"self",
".",
"_selected_obj",
".",
"copy",
"(",
")",
"if",
"obj_type",
"is",
... | return a new object with the replacement attributes | [
"return",
"a",
"new",
"object",
"with",
"the",
"replacement",
"attributes"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L619-L632 | train |
pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.itemsize | def itemsize(self):
"""
Return the size of the dtype of the item of the underlying data.
.. deprecated:: 0.23.0
"""
warnings.warn("{obj}.itemsize is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
... | python | def itemsize(self):
"""
Return the size of the dtype of the item of the underlying data.
.. deprecated:: 0.23.0
"""
warnings.warn("{obj}.itemsize is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
... | [
"def",
"itemsize",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"{obj}.itemsize is deprecated and will be removed \"",
"\"in a future version\"",
".",
"format",
"(",
"obj",
"=",
"type",
"(",
"self",
")",
".",
"__name__",
")",
",",
"FutureWarning",
",",
... | Return the size of the dtype of the item of the underlying data.
.. deprecated:: 0.23.0 | [
"Return",
"the",
"size",
"of",
"the",
"dtype",
"of",
"the",
"item",
"of",
"the",
"underlying",
"data",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L715-L724 | train |
pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.base | def base(self):
"""
Return the base object if the memory of the underlying data is shared.
.. deprecated:: 0.23.0
"""
warnings.warn("{obj}.base is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
... | python | def base(self):
"""
Return the base object if the memory of the underlying data is shared.
.. deprecated:: 0.23.0
"""
warnings.warn("{obj}.base is deprecated and will be removed "
"in a future version".format(obj=type(self).__name__),
... | [
"def",
"base",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"{obj}.base is deprecated and will be removed \"",
"\"in a future version\"",
".",
"format",
"(",
"obj",
"=",
"type",
"(",
"self",
")",
".",
"__name__",
")",
",",
"FutureWarning",
",",
"stackl... | Return the base object if the memory of the underlying data is shared.
.. deprecated:: 0.23.0 | [
"Return",
"the",
"base",
"object",
"if",
"the",
"memory",
"of",
"the",
"underlying",
"data",
"is",
"shared",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L765-L774 | train |
pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.array | def array(self) -> ExtensionArray:
"""
The ExtensionArray of the data backing this Series or Index.
.. versionadded:: 0.24.0
Returns
-------
ExtensionArray
An ExtensionArray of the values stored within. For extension
types, this is the actual arr... | python | def array(self) -> ExtensionArray:
"""
The ExtensionArray of the data backing this Series or Index.
.. versionadded:: 0.24.0
Returns
-------
ExtensionArray
An ExtensionArray of the values stored within. For extension
types, this is the actual arr... | [
"def",
"array",
"(",
"self",
")",
"->",
"ExtensionArray",
":",
"result",
"=",
"self",
".",
"_values",
"if",
"is_datetime64_ns_dtype",
"(",
"result",
".",
"dtype",
")",
":",
"from",
"pandas",
".",
"arrays",
"import",
"DatetimeArray",
"result",
"=",
"DatetimeA... | The ExtensionArray of the data backing this Series or Index.
.. versionadded:: 0.24.0
Returns
-------
ExtensionArray
An ExtensionArray of the values stored within. For extension
types, this is the actual array. For NumPy native types, this
is a thin ... | [
"The",
"ExtensionArray",
"of",
"the",
"data",
"backing",
"this",
"Series",
"or",
"Index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L777-L853 | train |
pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.to_numpy | def to_numpy(self, dtype=None, copy=False):
"""
A NumPy ndarray representing the values in this Series or Index.
.. versionadded:: 0.24.0
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.asarray`
copy : boo... | python | def to_numpy(self, dtype=None, copy=False):
"""
A NumPy ndarray representing the values in this Series or Index.
.. versionadded:: 0.24.0
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.asarray`
copy : boo... | [
"def",
"to_numpy",
"(",
"self",
",",
"dtype",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"if",
"is_datetime64tz_dtype",
"(",
"self",
".",
"dtype",
")",
"and",
"dtype",
"is",
"None",
":",
"# note: this is going to change very soon.",
"# I have a WIP PR mak... | A NumPy ndarray representing the values in this Series or Index.
.. versionadded:: 0.24.0
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.asarray`
copy : bool, default False
Whether to ensure that the returned... | [
"A",
"NumPy",
"ndarray",
"representing",
"the",
"values",
"in",
"this",
"Series",
"or",
"Index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L855-L949 | train |
pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin._ndarray_values | def _ndarray_values(self) -> np.ndarray:
"""
The data as an ndarray, possibly losing information.
The expectation is that this is cheap to compute, and is primarily
used for interacting with our indexers.
- categorical -> codes
"""
if is_extension_array_dtype(se... | python | def _ndarray_values(self) -> np.ndarray:
"""
The data as an ndarray, possibly losing information.
The expectation is that this is cheap to compute, and is primarily
used for interacting with our indexers.
- categorical -> codes
"""
if is_extension_array_dtype(se... | [
"def",
"_ndarray_values",
"(",
"self",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"is_extension_array_dtype",
"(",
"self",
")",
":",
"return",
"self",
".",
"array",
".",
"_ndarray_values",
"return",
"self",
".",
"values"
] | The data as an ndarray, possibly losing information.
The expectation is that this is cheap to compute, and is primarily
used for interacting with our indexers.
- categorical -> codes | [
"The",
"data",
"as",
"an",
"ndarray",
"possibly",
"losing",
"information",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L952-L963 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.