id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
20,200 | 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 |
20,201 | 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 |
20,202 | 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 |
20,203 | 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 |
20,204 | 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 |
20,205 | 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 |
20,206 | 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 |
20,207 | 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 |
20,208 | 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 |
20,209 | 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 |
20,210 | 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 |
20,211 | 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 |
20,212 | 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 |
20,213 | 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 |
20,214 | 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 |
20,215 | 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 |
20,216 | 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 |
20,217 | 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 |
20,218 | 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 |
20,219 | 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 |
20,220 | 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 |
20,221 | 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 |
20,222 | 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 |
20,223 | 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 |
20,224 | 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 |
20,225 | 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 |
20,226 | 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 |
20,227 | 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 |
20,228 | 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 |
20,229 | 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 |
20,230 | 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 |
20,231 | 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 |
20,232 | 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 |
20,233 | 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 |
20,234 | 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 |
20,235 | 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 |
20,236 | 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 |
20,237 | 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 |
20,238 | 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 |
20,239 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.max | def max(self, axis=None, skipna=True):
"""
Return the maximum value of the Index.
Parameters
----------
axis : int, optional
For compatibility with NumPy. Only 0 or None are allowed.
skipna : bool, default True
Returns
-------
scalar
... | python | def max(self, axis=None, skipna=True):
"""
Return the maximum value of the Index.
Parameters
----------
axis : int, optional
For compatibility with NumPy. Only 0 or None are allowed.
skipna : bool, default True
Returns
-------
scalar
... | [
"def",
"max",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
")",
":",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
"return",
"nanops",
".",
"nanmax",
"(",
"self",
".",
"_values",
",",
"skipna",
"=",
"skipna",
")"
] | Return the maximum value of the Index.
Parameters
----------
axis : int, optional
For compatibility with NumPy. Only 0 or None are allowed.
skipna : bool, default True
Returns
-------
scalar
Maximum value.
See Also
------... | [
"Return",
"the",
"maximum",
"value",
"of",
"the",
"Index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L969-L1007 |
20,240 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.argmax | def argmax(self, axis=None, skipna=True):
"""
Return an ndarray of the maximum argument indexer.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
See Also
--------
numpy.ndarra... | python | def argmax(self, axis=None, skipna=True):
"""
Return an ndarray of the maximum argument indexer.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
See Also
--------
numpy.ndarra... | [
"def",
"argmax",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
")",
":",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
"return",
"nanops",
".",
"nanargmax",
"(",
"self",
".",
"_values",
",",
"skipna",
"=",
"skipna",
")"
] | Return an ndarray of the maximum argument indexer.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
See Also
--------
numpy.ndarray.argmax | [
"Return",
"an",
"ndarray",
"of",
"the",
"maximum",
"argument",
"indexer",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1009-L1024 |
20,241 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.min | def min(self, axis=None, skipna=True):
"""
Return the minimum value of the Index.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
Returns
-------
scalar
Minimum va... | python | def min(self, axis=None, skipna=True):
"""
Return the minimum value of the Index.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
Returns
-------
scalar
Minimum va... | [
"def",
"min",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
")",
":",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
"return",
"nanops",
".",
"nanmin",
"(",
"self",
".",
"_values",
",",
"skipna",
"=",
"skipna",
")"
] | Return the minimum value of the Index.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
Returns
-------
scalar
Minimum value.
See Also
--------
Index.max :... | [
"Return",
"the",
"minimum",
"value",
"of",
"the",
"Index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1026-L1064 |
20,242 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.argmin | def argmin(self, axis=None, skipna=True):
"""
Return a ndarray of the minimum argument indexer.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
Returns
-------
numpy.ndarray
... | python | def argmin(self, axis=None, skipna=True):
"""
Return a ndarray of the minimum argument indexer.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
Returns
-------
numpy.ndarray
... | [
"def",
"argmin",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
")",
":",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
"return",
"nanops",
".",
"nanargmin",
"(",
"self",
".",
"_values",
",",
"skipna",
"=",
"skipna",
")"
] | Return a ndarray of the minimum argument indexer.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series
skipna : bool, default True
Returns
-------
numpy.ndarray
See Also
--------
numpy.ndarray.argmin | [
"Return",
"a",
"ndarray",
"of",
"the",
"minimum",
"argument",
"indexer",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1066-L1085 |
20,243 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.tolist | def tolist(self):
"""
Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
list
See Also
--------
n... | python | def tolist(self):
"""
Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
list
See Also
--------
n... | [
"def",
"tolist",
"(",
"self",
")",
":",
"if",
"is_datetimelike",
"(",
"self",
".",
"_values",
")",
":",
"return",
"[",
"com",
".",
"maybe_box_datetimelike",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"_values",
"]",
"elif",
"is_extension_array_dtype",
... | Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
list
See Also
--------
numpy.ndarray.tolist | [
"Return",
"a",
"list",
"of",
"the",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1087-L1108 |
20,244 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin._reduce | def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
filter_type=None, **kwds):
""" perform the reduction type operation if we can """
func = getattr(self, name, None)
if func is None:
raise TypeError("{klass} cannot perform the operation {op}".format(
... | python | def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
filter_type=None, **kwds):
""" perform the reduction type operation if we can """
func = getattr(self, name, None)
if func is None:
raise TypeError("{klass} cannot perform the operation {op}".format(
... | [
"def",
"_reduce",
"(",
"self",
",",
"op",
",",
"name",
",",
"axis",
"=",
"0",
",",
"skipna",
"=",
"True",
",",
"numeric_only",
"=",
"None",
",",
"filter_type",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"func",
"=",
"getattr",
"(",
"self",
","... | perform the reduction type operation if we can | [
"perform",
"the",
"reduction",
"type",
"operation",
"if",
"we",
"can"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1135-L1142 |
20,245 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.nunique | def nunique(self, dropna=True):
"""
Return number of unique elements in the object.
Excludes NA values by default.
Parameters
----------
dropna : bool, default True
Don't include NaN in the count.
Returns
-------
int
See Als... | python | def nunique(self, dropna=True):
"""
Return number of unique elements in the object.
Excludes NA values by default.
Parameters
----------
dropna : bool, default True
Don't include NaN in the count.
Returns
-------
int
See Als... | [
"def",
"nunique",
"(",
"self",
",",
"dropna",
"=",
"True",
")",
":",
"uniqs",
"=",
"self",
".",
"unique",
"(",
")",
"n",
"=",
"len",
"(",
"uniqs",
")",
"if",
"dropna",
"and",
"isna",
"(",
"uniqs",
")",
".",
"any",
"(",
")",
":",
"n",
"-=",
"1... | Return number of unique elements in the object.
Excludes NA values by default.
Parameters
----------
dropna : bool, default True
Don't include NaN in the count.
Returns
-------
int
See Also
--------
DataFrame.nunique: Method... | [
"Return",
"number",
"of",
"unique",
"elements",
"in",
"the",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1313-L1351 |
20,246 | pandas-dev/pandas | pandas/core/base.py | IndexOpsMixin.memory_usage | def memory_usage(self, deep=False):
"""
Memory usage of the values
Parameters
----------
deep : bool
Introspect the data deeply, interrogate
`object` dtypes for system-level memory consumption
Returns
-------
bytes used
S... | python | def memory_usage(self, deep=False):
"""
Memory usage of the values
Parameters
----------
deep : bool
Introspect the data deeply, interrogate
`object` dtypes for system-level memory consumption
Returns
-------
bytes used
S... | [
"def",
"memory_usage",
"(",
"self",
",",
"deep",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"array",
",",
"'memory_usage'",
")",
":",
"return",
"self",
".",
"array",
".",
"memory_usage",
"(",
"deep",
"=",
"deep",
")",
"v",
"=",
"self"... | Memory usage of the values
Parameters
----------
deep : bool
Introspect the data deeply, interrogate
`object` dtypes for system-level memory consumption
Returns
-------
bytes used
See Also
--------
numpy.ndarray.nbytes
... | [
"Memory",
"usage",
"of",
"the",
"values"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1396-L1425 |
20,247 | pandas-dev/pandas | pandas/io/common.py | _stringify_path | def _stringify_path(filepath_or_buffer):
"""Attempt to convert a path-like object to a string.
Parameters
----------
filepath_or_buffer : object to be converted
Returns
-------
str_filepath_or_buffer : maybe a string version of the object
Notes
-----
Objects supporting the fsp... | python | def _stringify_path(filepath_or_buffer):
"""Attempt to convert a path-like object to a string.
Parameters
----------
filepath_or_buffer : object to be converted
Returns
-------
str_filepath_or_buffer : maybe a string version of the object
Notes
-----
Objects supporting the fsp... | [
"def",
"_stringify_path",
"(",
"filepath_or_buffer",
")",
":",
"try",
":",
"import",
"pathlib",
"_PATHLIB_INSTALLED",
"=",
"True",
"except",
"ImportError",
":",
"_PATHLIB_INSTALLED",
"=",
"False",
"try",
":",
"from",
"py",
".",
"path",
"import",
"local",
"as",
... | Attempt to convert a path-like object to a string.
Parameters
----------
filepath_or_buffer : object to be converted
Returns
-------
str_filepath_or_buffer : maybe a string version of the object
Notes
-----
Objects supporting the fspath protocol (python 3.6+) are coerced
accor... | [
"Attempt",
"to",
"convert",
"a",
"path",
"-",
"like",
"object",
"to",
"a",
"string",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L96-L136 |
20,248 | pandas-dev/pandas | pandas/io/common.py | get_filepath_or_buffer | def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
compression=None, mode=None):
"""
If the filepath_or_buffer is a url, translate and return the buffer.
Otherwise passthrough.
Parameters
----------
filepath_or_buffer : a url, filepath (str, py.path.local o... | python | def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
compression=None, mode=None):
"""
If the filepath_or_buffer is a url, translate and return the buffer.
Otherwise passthrough.
Parameters
----------
filepath_or_buffer : a url, filepath (str, py.path.local o... | [
"def",
"get_filepath_or_buffer",
"(",
"filepath_or_buffer",
",",
"encoding",
"=",
"None",
",",
"compression",
"=",
"None",
",",
"mode",
"=",
"None",
")",
":",
"filepath_or_buffer",
"=",
"_stringify_path",
"(",
"filepath_or_buffer",
")",
"if",
"_is_url",
"(",
"fi... | If the filepath_or_buffer is a url, translate and return the buffer.
Otherwise passthrough.
Parameters
----------
filepath_or_buffer : a url, filepath (str, py.path.local or pathlib.Path),
or buffer
compression : {{'gzip', 'bz2', 'zip', 'xz', None}}, optional
encoding :... | [
"If",
"the",
"filepath_or_buffer",
"is",
"a",
"url",
"translate",
"and",
"return",
"the",
"buffer",
".",
"Otherwise",
"passthrough",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L155-L209 |
20,249 | pandas-dev/pandas | pandas/io/common.py | _infer_compression | def _infer_compression(filepath_or_buffer, compression):
"""
Get the compression method for filepath_or_buffer. If compression='infer',
the inferred compression method is returned. Otherwise, the input
compression method is returned unchanged, unless it's invalid, in which
case an error is raised.
... | python | def _infer_compression(filepath_or_buffer, compression):
"""
Get the compression method for filepath_or_buffer. If compression='infer',
the inferred compression method is returned. Otherwise, the input
compression method is returned unchanged, unless it's invalid, in which
case an error is raised.
... | [
"def",
"_infer_compression",
"(",
"filepath_or_buffer",
",",
"compression",
")",
":",
"# No compression has been explicitly specified",
"if",
"compression",
"is",
"None",
":",
"return",
"None",
"# Infer compression",
"if",
"compression",
"==",
"'infer'",
":",
"# Convert a... | Get the compression method for filepath_or_buffer. If compression='infer',
the inferred compression method is returned. Otherwise, the input
compression method is returned unchanged, unless it's invalid, in which
case an error is raised.
Parameters
----------
filepath_or_buffer :
a path... | [
"Get",
"the",
"compression",
"method",
"for",
"filepath_or_buffer",
".",
"If",
"compression",
"=",
"infer",
"the",
"inferred",
"compression",
"method",
"is",
"returned",
".",
"Otherwise",
"the",
"input",
"compression",
"method",
"is",
"returned",
"unchanged",
"unl... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L235-L286 |
20,250 | pandas-dev/pandas | pandas/core/arrays/timedeltas.py | _td_array_cmp | def _td_array_cmp(cls, op):
"""
Wrap comparison operations to convert timedelta-like to timedelta64
"""
opname = '__{name}__'.format(name=op.__name__)
nat_result = opname == '__ne__'
def wrapper(self, other):
if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)):
re... | python | def _td_array_cmp(cls, op):
"""
Wrap comparison operations to convert timedelta-like to timedelta64
"""
opname = '__{name}__'.format(name=op.__name__)
nat_result = opname == '__ne__'
def wrapper(self, other):
if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)):
re... | [
"def",
"_td_array_cmp",
"(",
"cls",
",",
"op",
")",
":",
"opname",
"=",
"'__{name}__'",
".",
"format",
"(",
"name",
"=",
"op",
".",
"__name__",
")",
"nat_result",
"=",
"opname",
"==",
"'__ne__'",
"def",
"wrapper",
"(",
"self",
",",
"other",
")",
":",
... | Wrap comparison operations to convert timedelta-like to timedelta64 | [
"Wrap",
"comparison",
"operations",
"to",
"convert",
"timedelta",
"-",
"like",
"to",
"timedelta64"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L56-L102 |
20,251 | pandas-dev/pandas | pandas/io/excel/_util.py | register_writer | def register_writer(klass):
"""
Add engine to the excel writer registry.io.excel.
You must use this method to integrate with ``to_excel``.
Parameters
----------
klass : ExcelWriter
"""
if not callable(klass):
raise ValueError("Can only register callables as engines")
engine... | python | def register_writer(klass):
"""
Add engine to the excel writer registry.io.excel.
You must use this method to integrate with ``to_excel``.
Parameters
----------
klass : ExcelWriter
"""
if not callable(klass):
raise ValueError("Can only register callables as engines")
engine... | [
"def",
"register_writer",
"(",
"klass",
")",
":",
"if",
"not",
"callable",
"(",
"klass",
")",
":",
"raise",
"ValueError",
"(",
"\"Can only register callables as engines\"",
")",
"engine_name",
"=",
"klass",
".",
"engine",
"_writers",
"[",
"engine_name",
"]",
"="... | Add engine to the excel writer registry.io.excel.
You must use this method to integrate with ``to_excel``.
Parameters
----------
klass : ExcelWriter | [
"Add",
"engine",
"to",
"the",
"excel",
"writer",
"registry",
".",
"io",
".",
"excel",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L10-L23 |
20,252 | pandas-dev/pandas | pandas/io/excel/_util.py | _excel2num | def _excel2num(x):
"""
Convert Excel column name like 'AB' to 0-based column index.
Parameters
----------
x : str
The Excel column name to convert to a 0-based column index.
Returns
-------
num : int
The column index corresponding to the name.
Raises
------
... | python | def _excel2num(x):
"""
Convert Excel column name like 'AB' to 0-based column index.
Parameters
----------
x : str
The Excel column name to convert to a 0-based column index.
Returns
-------
num : int
The column index corresponding to the name.
Raises
------
... | [
"def",
"_excel2num",
"(",
"x",
")",
":",
"index",
"=",
"0",
"for",
"c",
"in",
"x",
".",
"upper",
"(",
")",
".",
"strip",
"(",
")",
":",
"cp",
"=",
"ord",
"(",
"c",
")",
"if",
"cp",
"<",
"ord",
"(",
"\"A\"",
")",
"or",
"cp",
">",
"ord",
"(... | Convert Excel column name like 'AB' to 0-based column index.
Parameters
----------
x : str
The Excel column name to convert to a 0-based column index.
Returns
-------
num : int
The column index corresponding to the name.
Raises
------
ValueError
Part of the... | [
"Convert",
"Excel",
"column",
"name",
"like",
"AB",
"to",
"0",
"-",
"based",
"column",
"index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L57-L86 |
20,253 | pandas-dev/pandas | pandas/io/excel/_util.py | _range2cols | def _range2cols(areas):
"""
Convert comma separated list of column names and ranges to indices.
Parameters
----------
areas : str
A string containing a sequence of column ranges (or areas).
Returns
-------
cols : list
A list of 0-based column indices.
Examples
... | python | def _range2cols(areas):
"""
Convert comma separated list of column names and ranges to indices.
Parameters
----------
areas : str
A string containing a sequence of column ranges (or areas).
Returns
-------
cols : list
A list of 0-based column indices.
Examples
... | [
"def",
"_range2cols",
"(",
"areas",
")",
":",
"cols",
"=",
"[",
"]",
"for",
"rng",
"in",
"areas",
".",
"split",
"(",
"\",\"",
")",
":",
"if",
"\":\"",
"in",
"rng",
":",
"rng",
"=",
"rng",
".",
"split",
"(",
"\":\"",
")",
"cols",
".",
"extend",
... | Convert comma separated list of column names and ranges to indices.
Parameters
----------
areas : str
A string containing a sequence of column ranges (or areas).
Returns
-------
cols : list
A list of 0-based column indices.
Examples
--------
>>> _range2cols('A:E')
... | [
"Convert",
"comma",
"separated",
"list",
"of",
"column",
"names",
"and",
"ranges",
"to",
"indices",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L89-L119 |
20,254 | pandas-dev/pandas | pandas/io/excel/_util.py | _maybe_convert_usecols | def _maybe_convert_usecols(usecols):
"""
Convert `usecols` into a compatible format for parsing in `parsers.py`.
Parameters
----------
usecols : object
The use-columns object to potentially convert.
Returns
-------
converted : object
The compatible format of `usecols`.
... | python | def _maybe_convert_usecols(usecols):
"""
Convert `usecols` into a compatible format for parsing in `parsers.py`.
Parameters
----------
usecols : object
The use-columns object to potentially convert.
Returns
-------
converted : object
The compatible format of `usecols`.
... | [
"def",
"_maybe_convert_usecols",
"(",
"usecols",
")",
":",
"if",
"usecols",
"is",
"None",
":",
"return",
"usecols",
"if",
"is_integer",
"(",
"usecols",
")",
":",
"warnings",
".",
"warn",
"(",
"(",
"\"Passing in an integer for `usecols` has been \"",
"\"deprecated. P... | Convert `usecols` into a compatible format for parsing in `parsers.py`.
Parameters
----------
usecols : object
The use-columns object to potentially convert.
Returns
-------
converted : object
The compatible format of `usecols`. | [
"Convert",
"usecols",
"into",
"a",
"compatible",
"format",
"for",
"parsing",
"in",
"parsers",
".",
"py",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L122-L149 |
20,255 | pandas-dev/pandas | pandas/io/excel/_util.py | _fill_mi_header | def _fill_mi_header(row, control_row):
"""Forward fill blank entries in row but only inside the same parent index.
Used for creating headers in Multiindex.
Parameters
----------
row : list
List of items in a single row.
control_row : list of bool
Helps to determine if particular... | python | def _fill_mi_header(row, control_row):
"""Forward fill blank entries in row but only inside the same parent index.
Used for creating headers in Multiindex.
Parameters
----------
row : list
List of items in a single row.
control_row : list of bool
Helps to determine if particular... | [
"def",
"_fill_mi_header",
"(",
"row",
",",
"control_row",
")",
":",
"last",
"=",
"row",
"[",
"0",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"row",
")",
")",
":",
"if",
"not",
"control_row",
"[",
"i",
"]",
":",
"last",
"=",
"row... | Forward fill blank entries in row but only inside the same parent index.
Used for creating headers in Multiindex.
Parameters
----------
row : list
List of items in a single row.
control_row : list of bool
Helps to determine if particular column is in same parent index as the
... | [
"Forward",
"fill",
"blank",
"entries",
"in",
"row",
"but",
"only",
"inside",
"the",
"same",
"parent",
"index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L176-L204 |
20,256 | pandas-dev/pandas | pandas/io/excel/_util.py | _pop_header_name | def _pop_header_name(row, index_col):
"""
Pop the header name for MultiIndex parsing.
Parameters
----------
row : list
The data row to parse for the header name.
index_col : int, list
The index columns for our data. Assumed to be non-null.
Returns
-------
header_nam... | python | def _pop_header_name(row, index_col):
"""
Pop the header name for MultiIndex parsing.
Parameters
----------
row : list
The data row to parse for the header name.
index_col : int, list
The index columns for our data. Assumed to be non-null.
Returns
-------
header_nam... | [
"def",
"_pop_header_name",
"(",
"row",
",",
"index_col",
")",
":",
"# Pop out header name and fill w/blank.",
"i",
"=",
"index_col",
"if",
"not",
"is_list_like",
"(",
"index_col",
")",
"else",
"max",
"(",
"index_col",
")",
"header_name",
"=",
"row",
"[",
"i",
... | Pop the header name for MultiIndex parsing.
Parameters
----------
row : list
The data row to parse for the header name.
index_col : int, list
The index columns for our data. Assumed to be non-null.
Returns
-------
header_name : str
The extracted header name.
tri... | [
"Pop",
"the",
"header",
"name",
"for",
"MultiIndex",
"parsing",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L207-L231 |
20,257 | pandas-dev/pandas | pandas/core/computation/scope.py | _ensure_scope | def _ensure_scope(level, global_dict=None, local_dict=None, resolvers=(),
target=None, **kwargs):
"""Ensure that we are grabbing the correct scope."""
return Scope(level + 1, global_dict=global_dict, local_dict=local_dict,
resolvers=resolvers, target=target) | python | def _ensure_scope(level, global_dict=None, local_dict=None, resolvers=(),
target=None, **kwargs):
"""Ensure that we are grabbing the correct scope."""
return Scope(level + 1, global_dict=global_dict, local_dict=local_dict,
resolvers=resolvers, target=target) | [
"def",
"_ensure_scope",
"(",
"level",
",",
"global_dict",
"=",
"None",
",",
"local_dict",
"=",
"None",
",",
"resolvers",
"=",
"(",
")",
",",
"target",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Scope",
"(",
"level",
"+",
"1",
",",
"... | Ensure that we are grabbing the correct scope. | [
"Ensure",
"that",
"we",
"are",
"grabbing",
"the",
"correct",
"scope",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L22-L26 |
20,258 | pandas-dev/pandas | pandas/core/computation/scope.py | _replacer | def _replacer(x):
"""Replace a number with its hexadecimal representation. Used to tag
temporary variables with their calling scope's id.
"""
# get the hex repr of the binary char and remove 0x and pad by pad_size
# zeros
try:
hexin = ord(x)
except TypeError:
# bytes literals... | python | def _replacer(x):
"""Replace a number with its hexadecimal representation. Used to tag
temporary variables with their calling scope's id.
"""
# get the hex repr of the binary char and remove 0x and pad by pad_size
# zeros
try:
hexin = ord(x)
except TypeError:
# bytes literals... | [
"def",
"_replacer",
"(",
"x",
")",
":",
"# get the hex repr of the binary char and remove 0x and pad by pad_size",
"# zeros",
"try",
":",
"hexin",
"=",
"ord",
"(",
"x",
")",
"except",
"TypeError",
":",
"# bytes literals masquerade as ints when iterating in py3",
"hexin",
"=... | Replace a number with its hexadecimal representation. Used to tag
temporary variables with their calling scope's id. | [
"Replace",
"a",
"number",
"with",
"its",
"hexadecimal",
"representation",
".",
"Used",
"to",
"tag",
"temporary",
"variables",
"with",
"their",
"calling",
"scope",
"s",
"id",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L29-L41 |
20,259 | pandas-dev/pandas | pandas/core/computation/scope.py | _raw_hex_id | def _raw_hex_id(obj):
"""Return the padded hexadecimal id of ``obj``."""
# interpret as a pointer since that's what really what id returns
packed = struct.pack('@P', id(obj))
return ''.join(map(_replacer, packed)) | python | def _raw_hex_id(obj):
"""Return the padded hexadecimal id of ``obj``."""
# interpret as a pointer since that's what really what id returns
packed = struct.pack('@P', id(obj))
return ''.join(map(_replacer, packed)) | [
"def",
"_raw_hex_id",
"(",
"obj",
")",
":",
"# interpret as a pointer since that's what really what id returns",
"packed",
"=",
"struct",
".",
"pack",
"(",
"'@P'",
",",
"id",
"(",
"obj",
")",
")",
"return",
"''",
".",
"join",
"(",
"map",
"(",
"_replacer",
",",... | Return the padded hexadecimal id of ``obj``. | [
"Return",
"the",
"padded",
"hexadecimal",
"id",
"of",
"obj",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L44-L48 |
20,260 | pandas-dev/pandas | pandas/core/computation/scope.py | _get_pretty_string | def _get_pretty_string(obj):
"""Return a prettier version of obj
Parameters
----------
obj : object
Object to pretty print
Returns
-------
s : str
Pretty print object repr
"""
sio = StringIO()
pprint.pprint(obj, stream=sio)
return sio.getvalue() | python | def _get_pretty_string(obj):
"""Return a prettier version of obj
Parameters
----------
obj : object
Object to pretty print
Returns
-------
s : str
Pretty print object repr
"""
sio = StringIO()
pprint.pprint(obj, stream=sio)
return sio.getvalue() | [
"def",
"_get_pretty_string",
"(",
"obj",
")",
":",
"sio",
"=",
"StringIO",
"(",
")",
"pprint",
".",
"pprint",
"(",
"obj",
",",
"stream",
"=",
"sio",
")",
"return",
"sio",
".",
"getvalue",
"(",
")"
] | Return a prettier version of obj
Parameters
----------
obj : object
Object to pretty print
Returns
-------
s : str
Pretty print object repr | [
"Return",
"a",
"prettier",
"version",
"of",
"obj"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L63-L78 |
20,261 | pandas-dev/pandas | pandas/core/computation/scope.py | Scope.resolve | def resolve(self, key, is_local):
"""Resolve a variable name in a possibly local context
Parameters
----------
key : str
A variable name
is_local : bool
Flag indicating whether the variable is local or not (prefixed with
the '@' symbol)
... | python | def resolve(self, key, is_local):
"""Resolve a variable name in a possibly local context
Parameters
----------
key : str
A variable name
is_local : bool
Flag indicating whether the variable is local or not (prefixed with
the '@' symbol)
... | [
"def",
"resolve",
"(",
"self",
",",
"key",
",",
"is_local",
")",
":",
"try",
":",
"# only look for locals in outer scope",
"if",
"is_local",
":",
"return",
"self",
".",
"scope",
"[",
"key",
"]",
"# not a local variable so check in resolvers if we have them",
"if",
"... | Resolve a variable name in a possibly local context
Parameters
----------
key : str
A variable name
is_local : bool
Flag indicating whether the variable is local or not (prefixed with
the '@' symbol)
Returns
-------
value : ob... | [
"Resolve",
"a",
"variable",
"name",
"in",
"a",
"possibly",
"local",
"context"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L159-L195 |
20,262 | pandas-dev/pandas | pandas/core/computation/scope.py | Scope.swapkey | def swapkey(self, old_key, new_key, new_value=None):
"""Replace a variable name, with a potentially new value.
Parameters
----------
old_key : str
Current variable name to replace
new_key : str
New variable name to replace `old_key` with
new_value... | python | def swapkey(self, old_key, new_key, new_value=None):
"""Replace a variable name, with a potentially new value.
Parameters
----------
old_key : str
Current variable name to replace
new_key : str
New variable name to replace `old_key` with
new_value... | [
"def",
"swapkey",
"(",
"self",
",",
"old_key",
",",
"new_key",
",",
"new_value",
"=",
"None",
")",
":",
"if",
"self",
".",
"has_resolvers",
":",
"maps",
"=",
"self",
".",
"resolvers",
".",
"maps",
"+",
"self",
".",
"scope",
".",
"maps",
"else",
":",
... | Replace a variable name, with a potentially new value.
Parameters
----------
old_key : str
Current variable name to replace
new_key : str
New variable name to replace `old_key` with
new_value : object
Value to be replaced along with the possib... | [
"Replace",
"a",
"variable",
"name",
"with",
"a",
"potentially",
"new",
"value",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L197-L219 |
20,263 | pandas-dev/pandas | pandas/core/computation/scope.py | Scope._get_vars | def _get_vars(self, stack, scopes):
"""Get specifically scoped variables from a list of stack frames.
Parameters
----------
stack : list
A list of stack frames as returned by ``inspect.stack()``
scopes : sequence of strings
A sequence containing valid sta... | python | def _get_vars(self, stack, scopes):
"""Get specifically scoped variables from a list of stack frames.
Parameters
----------
stack : list
A list of stack frames as returned by ``inspect.stack()``
scopes : sequence of strings
A sequence containing valid sta... | [
"def",
"_get_vars",
"(",
"self",
",",
"stack",
",",
"scopes",
")",
":",
"variables",
"=",
"itertools",
".",
"product",
"(",
"scopes",
",",
"stack",
")",
"for",
"scope",
",",
"(",
"frame",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
")",
"... | Get specifically scoped variables from a list of stack frames.
Parameters
----------
stack : list
A list of stack frames as returned by ``inspect.stack()``
scopes : sequence of strings
A sequence containing valid stack frame attribute names that
evalu... | [
"Get",
"specifically",
"scoped",
"variables",
"from",
"a",
"list",
"of",
"stack",
"frames",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L221-L241 |
20,264 | pandas-dev/pandas | pandas/core/computation/scope.py | Scope.update | def update(self, level):
"""Update the current scope by going back `level` levels.
Parameters
----------
level : int or None, optional, default None
"""
sl = level + 1
# add sl frames to the scope starting with the
# most distant and overwriting with mor... | python | def update(self, level):
"""Update the current scope by going back `level` levels.
Parameters
----------
level : int or None, optional, default None
"""
sl = level + 1
# add sl frames to the scope starting with the
# most distant and overwriting with mor... | [
"def",
"update",
"(",
"self",
",",
"level",
")",
":",
"sl",
"=",
"level",
"+",
"1",
"# add sl frames to the scope starting with the",
"# most distant and overwriting with more current",
"# makes sure that we can capture variable scope",
"stack",
"=",
"inspect",
".",
"stack",
... | Update the current scope by going back `level` levels.
Parameters
----------
level : int or None, optional, default None | [
"Update",
"the",
"current",
"scope",
"by",
"going",
"back",
"level",
"levels",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L243-L260 |
20,265 | pandas-dev/pandas | pandas/core/computation/scope.py | Scope.add_tmp | def add_tmp(self, value):
"""Add a temporary variable to the scope.
Parameters
----------
value : object
An arbitrary object to be assigned to a temporary variable.
Returns
-------
name : basestring
The name of the temporary variable crea... | python | def add_tmp(self, value):
"""Add a temporary variable to the scope.
Parameters
----------
value : object
An arbitrary object to be assigned to a temporary variable.
Returns
-------
name : basestring
The name of the temporary variable crea... | [
"def",
"add_tmp",
"(",
"self",
",",
"value",
")",
":",
"name",
"=",
"'{name}_{num}_{hex_id}'",
".",
"format",
"(",
"name",
"=",
"type",
"(",
"value",
")",
".",
"__name__",
",",
"num",
"=",
"self",
".",
"ntemps",
",",
"hex_id",
"=",
"_raw_hex_id",
"(",
... | Add a temporary variable to the scope.
Parameters
----------
value : object
An arbitrary object to be assigned to a temporary variable.
Returns
-------
name : basestring
The name of the temporary variable created. | [
"Add",
"a",
"temporary",
"variable",
"to",
"the",
"scope",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L262-L285 |
20,266 | pandas-dev/pandas | pandas/core/computation/scope.py | Scope.full_scope | def full_scope(self):
"""Return the full scope for use with passing to engines transparently
as a mapping.
Returns
-------
vars : DeepChainMap
All variables in this scope.
"""
maps = [self.temps] + self.resolvers.maps + self.scope.maps
return ... | python | def full_scope(self):
"""Return the full scope for use with passing to engines transparently
as a mapping.
Returns
-------
vars : DeepChainMap
All variables in this scope.
"""
maps = [self.temps] + self.resolvers.maps + self.scope.maps
return ... | [
"def",
"full_scope",
"(",
"self",
")",
":",
"maps",
"=",
"[",
"self",
".",
"temps",
"]",
"+",
"self",
".",
"resolvers",
".",
"maps",
"+",
"self",
".",
"scope",
".",
"maps",
"return",
"DeepChainMap",
"(",
"*",
"maps",
")"
] | Return the full scope for use with passing to engines transparently
as a mapping.
Returns
-------
vars : DeepChainMap
All variables in this scope. | [
"Return",
"the",
"full",
"scope",
"for",
"use",
"with",
"passing",
"to",
"engines",
"transparently",
"as",
"a",
"mapping",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L293-L303 |
20,267 | pandas-dev/pandas | pandas/io/sas/sasreader.py | read_sas | def read_sas(filepath_or_buffer, format=None, index=None, encoding=None,
chunksize=None, iterator=False):
"""
Read SAS files stored as either XPORT or SAS7BDAT format files.
Parameters
----------
filepath_or_buffer : string or file-like object
Path to the SAS file.
format :... | python | def read_sas(filepath_or_buffer, format=None, index=None, encoding=None,
chunksize=None, iterator=False):
"""
Read SAS files stored as either XPORT or SAS7BDAT format files.
Parameters
----------
filepath_or_buffer : string or file-like object
Path to the SAS file.
format :... | [
"def",
"read_sas",
"(",
"filepath_or_buffer",
",",
"format",
"=",
"None",
",",
"index",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"chunksize",
"=",
"None",
",",
"iterator",
"=",
"False",
")",
":",
"if",
"format",
"is",
"None",
":",
"buffer_error_ms... | Read SAS files stored as either XPORT or SAS7BDAT format files.
Parameters
----------
filepath_or_buffer : string or file-like object
Path to the SAS file.
format : string {'xport', 'sas7bdat'} or None
If None, file format is inferred from file extension. If 'xport' or
'sas7bdat... | [
"Read",
"SAS",
"files",
"stored",
"as",
"either",
"XPORT",
"or",
"SAS7BDAT",
"format",
"files",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/sas/sasreader.py#L7-L66 |
20,268 | pandas-dev/pandas | pandas/core/series.py | _coerce_method | def _coerce_method(converter):
"""
Install the scalar coercion methods.
"""
def wrapper(self):
if len(self) == 1:
return converter(self.iloc[0])
raise TypeError("cannot convert the series to "
"{0}".format(str(converter)))
wrapper.__name__ = "__{... | python | def _coerce_method(converter):
"""
Install the scalar coercion methods.
"""
def wrapper(self):
if len(self) == 1:
return converter(self.iloc[0])
raise TypeError("cannot convert the series to "
"{0}".format(str(converter)))
wrapper.__name__ = "__{... | [
"def",
"_coerce_method",
"(",
"converter",
")",
":",
"def",
"wrapper",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
")",
"==",
"1",
":",
"return",
"converter",
"(",
"self",
".",
"iloc",
"[",
"0",
"]",
")",
"raise",
"TypeError",
"(",
"\"cannot con... | Install the scalar coercion methods. | [
"Install",
"the",
"scalar",
"coercion",
"methods",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L80-L92 |
20,269 | pandas-dev/pandas | pandas/core/series.py | Series._init_dict | def _init_dict(self, data, index=None, dtype=None):
"""
Derive the "_data" and "index" attributes of a new Series from a
dictionary input.
Parameters
----------
data : dict or dict-like
Data used to populate the new Series
index : Index or index-like,... | python | def _init_dict(self, data, index=None, dtype=None):
"""
Derive the "_data" and "index" attributes of a new Series from a
dictionary input.
Parameters
----------
data : dict or dict-like
Data used to populate the new Series
index : Index or index-like,... | [
"def",
"_init_dict",
"(",
"self",
",",
"data",
",",
"index",
"=",
"None",
",",
"dtype",
"=",
"None",
")",
":",
"# Looking for NaN in dict doesn't work ({np.nan : 1}[float('nan')]",
"# raises KeyError), so we iterate the entire dict, and align",
"if",
"data",
":",
"keys",
... | Derive the "_data" and "index" attributes of a new Series from a
dictionary input.
Parameters
----------
data : dict or dict-like
Data used to populate the new Series
index : Index or index-like, default None
index for the new Series: if None, use dict ke... | [
"Derive",
"the",
"_data",
"and",
"index",
"attributes",
"of",
"a",
"new",
"Series",
"from",
"a",
"dictionary",
"input",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L267-L312 |
20,270 | pandas-dev/pandas | pandas/core/series.py | Series.from_array | def from_array(cls, arr, index=None, name=None, dtype=None, copy=False,
fastpath=False):
"""
Construct Series from array.
.. deprecated :: 0.23.0
Use pd.Series(..) constructor instead.
"""
warnings.warn("'from_array' is deprecated and will be remov... | python | def from_array(cls, arr, index=None, name=None, dtype=None, copy=False,
fastpath=False):
"""
Construct Series from array.
.. deprecated :: 0.23.0
Use pd.Series(..) constructor instead.
"""
warnings.warn("'from_array' is deprecated and will be remov... | [
"def",
"from_array",
"(",
"cls",
",",
"arr",
",",
"index",
"=",
"None",
",",
"name",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"copy",
"=",
"False",
",",
"fastpath",
"=",
"False",
")",
":",
"warnings",
".",
"warn",
"(",
"\"'from_array' is deprecated... | Construct Series from array.
.. deprecated :: 0.23.0
Use pd.Series(..) constructor instead. | [
"Construct",
"Series",
"from",
"array",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L315-L330 |
20,271 | pandas-dev/pandas | pandas/core/series.py | Series._set_axis | def _set_axis(self, axis, labels, fastpath=False):
"""
Override generic, we want to set the _typ here.
"""
if not fastpath:
labels = ensure_index(labels)
is_all_dates = labels.is_all_dates
if is_all_dates:
if not isinstance(labels,
... | python | def _set_axis(self, axis, labels, fastpath=False):
"""
Override generic, we want to set the _typ here.
"""
if not fastpath:
labels = ensure_index(labels)
is_all_dates = labels.is_all_dates
if is_all_dates:
if not isinstance(labels,
... | [
"def",
"_set_axis",
"(",
"self",
",",
"axis",
",",
"labels",
",",
"fastpath",
"=",
"False",
")",
":",
"if",
"not",
"fastpath",
":",
"labels",
"=",
"ensure_index",
"(",
"labels",
")",
"is_all_dates",
"=",
"labels",
".",
"is_all_dates",
"if",
"is_all_dates",... | Override generic, we want to set the _typ here. | [
"Override",
"generic",
"we",
"want",
"to",
"set",
"the",
"_typ",
"here",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L350-L376 |
20,272 | pandas-dev/pandas | pandas/core/series.py | Series.asobject | def asobject(self):
"""
Return object Series which contains boxed values.
.. deprecated :: 0.23.0
Use ``astype(object)`` instead.
*this is an internal non-public method*
"""
warnings.warn("'asobject' is deprecated. Use 'astype(object)'"
... | python | def asobject(self):
"""
Return object Series which contains boxed values.
.. deprecated :: 0.23.0
Use ``astype(object)`` instead.
*this is an internal non-public method*
"""
warnings.warn("'asobject' is deprecated. Use 'astype(object)'"
... | [
"def",
"asobject",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"'asobject' is deprecated. Use 'astype(object)'\"",
"\" instead\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"self",
".",
"astype",
"(",
"object",
")",
".",
"value... | Return object Series which contains boxed values.
.. deprecated :: 0.23.0
Use ``astype(object)`` instead.
*this is an internal non-public method* | [
"Return",
"object",
"Series",
"which",
"contains",
"boxed",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L493-L505 |
20,273 | pandas-dev/pandas | pandas/core/series.py | Series.compress | def compress(self, condition, *args, **kwargs):
"""
Return selected slices of an array along given axis as a Series.
.. deprecated:: 0.24.0
See Also
--------
numpy.ndarray.compress
"""
msg = ("Series.compress(condition) is deprecated. "
"U... | python | def compress(self, condition, *args, **kwargs):
"""
Return selected slices of an array along given axis as a Series.
.. deprecated:: 0.24.0
See Also
--------
numpy.ndarray.compress
"""
msg = ("Series.compress(condition) is deprecated. "
"U... | [
"def",
"compress",
"(",
"self",
",",
"condition",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"(",
"\"Series.compress(condition) is deprecated. \"",
"\"Use 'Series[condition]' or \"",
"\"'np.asarray(series).compress(condition)' instead.\"",
")",
"warn... | Return selected slices of an array along given axis as a Series.
.. deprecated:: 0.24.0
See Also
--------
numpy.ndarray.compress | [
"Return",
"selected",
"slices",
"of",
"an",
"array",
"along",
"given",
"axis",
"as",
"a",
"Series",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L523-L538 |
20,274 | pandas-dev/pandas | pandas/core/series.py | Series.view | def view(self, dtype=None):
"""
Create a new view of the Series.
This function will return a new Series with a view of the same
underlying values in memory, optionally reinterpreted with a new data
type. The new data type must preserve the same size in bytes as to not
ca... | python | def view(self, dtype=None):
"""
Create a new view of the Series.
This function will return a new Series with a view of the same
underlying values in memory, optionally reinterpreted with a new data
type. The new data type must preserve the same size in bytes as to not
ca... | [
"def",
"view",
"(",
"self",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"self",
".",
"_constructor",
"(",
"self",
".",
"_values",
".",
"view",
"(",
"dtype",
")",
",",
"index",
"=",
"self",
".",
"index",
")",
".",
"__finalize__",
"(",
"self",
")"... | Create a new view of the Series.
This function will return a new Series with a view of the same
underlying values in memory, optionally reinterpreted with a new data
type. The new data type must preserve the same size in bytes as to not
cause index misalignment.
Parameters
... | [
"Create",
"a",
"new",
"view",
"of",
"the",
"Series",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L598-L665 |
20,275 | pandas-dev/pandas | pandas/core/series.py | Series._ixs | def _ixs(self, i, axis=0):
"""
Return the i-th value or values in the Series by location.
Parameters
----------
i : int, slice, or sequence of integers
Returns
-------
scalar (int) or Series (slice, sequence)
"""
try:
# dispa... | python | def _ixs(self, i, axis=0):
"""
Return the i-th value or values in the Series by location.
Parameters
----------
i : int, slice, or sequence of integers
Returns
-------
scalar (int) or Series (slice, sequence)
"""
try:
# dispa... | [
"def",
"_ixs",
"(",
"self",
",",
"i",
",",
"axis",
"=",
"0",
")",
":",
"try",
":",
"# dispatch to the values if we need",
"values",
"=",
"self",
".",
"_values",
"if",
"isinstance",
"(",
"values",
",",
"np",
".",
"ndarray",
")",
":",
"return",
"libindex",... | Return the i-th value or values in the Series by location.
Parameters
----------
i : int, slice, or sequence of integers
Returns
-------
scalar (int) or Series (slice, sequence) | [
"Return",
"the",
"i",
"-",
"th",
"value",
"or",
"values",
"in",
"the",
"Series",
"by",
"location",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L824-L855 |
20,276 | pandas-dev/pandas | pandas/core/series.py | Series.repeat | def repeat(self, repeats, axis=None):
"""
Repeat elements of a Series.
Returns a new Series where each element of the current Series
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
The number of... | python | def repeat(self, repeats, axis=None):
"""
Repeat elements of a Series.
Returns a new Series where each element of the current Series
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
The number of... | [
"def",
"repeat",
"(",
"self",
",",
"repeats",
",",
"axis",
"=",
"None",
")",
":",
"nv",
".",
"validate_repeat",
"(",
"tuple",
"(",
")",
",",
"dict",
"(",
"axis",
"=",
"axis",
")",
")",
"new_index",
"=",
"self",
".",
"index",
".",
"repeat",
"(",
"... | Repeat elements of a Series.
Returns a new Series where each element of the current Series
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
The number of repetitions for each element. This should be a
... | [
"Repeat",
"elements",
"of",
"a",
"Series",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1105-L1161 |
20,277 | pandas-dev/pandas | pandas/core/series.py | Series.reset_index | def reset_index(self, level=None, drop=False, name=None, inplace=False):
"""
Generate a new DataFrame or Series with the index reset.
This is useful when the index needs to be treated as a column, or
when the index is meaningless and needs to be reset to the default
before anoth... | python | def reset_index(self, level=None, drop=False, name=None, inplace=False):
"""
Generate a new DataFrame or Series with the index reset.
This is useful when the index needs to be treated as a column, or
when the index is meaningless and needs to be reset to the default
before anoth... | [
"def",
"reset_index",
"(",
"self",
",",
"level",
"=",
"None",
",",
"drop",
"=",
"False",
",",
"name",
"=",
"None",
",",
"inplace",
"=",
"False",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",",
"'inplace'",
")",
"if",
"drop",
":",
... | Generate a new DataFrame or Series with the index reset.
This is useful when the index needs to be treated as a column, or
when the index is meaningless and needs to be reset to the default
before another operation.
Parameters
----------
level : int, str, tuple, or list... | [
"Generate",
"a",
"new",
"DataFrame",
"or",
"Series",
"with",
"the",
"index",
"reset",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1235-L1365 |
20,278 | pandas-dev/pandas | pandas/core/series.py | Series.to_string | def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True,
index=True, length=False, dtype=False, name=False,
max_rows=None):
"""
Render a string representation of the Series.
Parameters
----------
buf : StringIO-like, optiona... | python | def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True,
index=True, length=False, dtype=False, name=False,
max_rows=None):
"""
Render a string representation of the Series.
Parameters
----------
buf : StringIO-like, optiona... | [
"def",
"to_string",
"(",
"self",
",",
"buf",
"=",
"None",
",",
"na_rep",
"=",
"'NaN'",
",",
"float_format",
"=",
"None",
",",
"header",
"=",
"True",
",",
"index",
"=",
"True",
",",
"length",
"=",
"False",
",",
"dtype",
"=",
"False",
",",
"name",
"=... | Render a string representation of the Series.
Parameters
----------
buf : StringIO-like, optional
Buffer to write to.
na_rep : str, optional
String representation of NaN to use, default 'NaN'.
float_format : one-parameter function, optional
Fo... | [
"Render",
"a",
"string",
"representation",
"of",
"the",
"Series",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1386-L1441 |
20,279 | pandas-dev/pandas | pandas/core/series.py | Series.to_frame | def to_frame(self, name=None):
"""
Convert Series to DataFrame.
Parameters
----------
name : object, default None
The passed name should substitute for the series name (if it has
one).
Returns
-------
DataFrame
DataFra... | python | def to_frame(self, name=None):
"""
Convert Series to DataFrame.
Parameters
----------
name : object, default None
The passed name should substitute for the series name (if it has
one).
Returns
-------
DataFrame
DataFra... | [
"def",
"to_frame",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"df",
"=",
"self",
".",
"_constructor_expanddim",
"(",
"self",
")",
"else",
":",
"df",
"=",
"self",
".",
"_constructor_expanddim",
"(",
"{",
"name",
... | Convert Series to DataFrame.
Parameters
----------
name : object, default None
The passed name should substitute for the series name (if it has
one).
Returns
-------
DataFrame
DataFrame representation of Series.
Examples
... | [
"Convert",
"Series",
"to",
"DataFrame",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1520-L1550 |
20,280 | pandas-dev/pandas | pandas/core/series.py | Series.to_sparse | def to_sparse(self, kind='block', fill_value=None):
"""
Convert Series to SparseSeries.
Parameters
----------
kind : {'block', 'integer'}, default 'block'
fill_value : float, defaults to NaN (missing)
Value to use for filling NaN values.
Returns
... | python | def to_sparse(self, kind='block', fill_value=None):
"""
Convert Series to SparseSeries.
Parameters
----------
kind : {'block', 'integer'}, default 'block'
fill_value : float, defaults to NaN (missing)
Value to use for filling NaN values.
Returns
... | [
"def",
"to_sparse",
"(",
"self",
",",
"kind",
"=",
"'block'",
",",
"fill_value",
"=",
"None",
")",
":",
"# TODO: deprecate",
"from",
"pandas",
".",
"core",
".",
"sparse",
".",
"series",
"import",
"SparseSeries",
"values",
"=",
"SparseArray",
"(",
"self",
"... | Convert Series to SparseSeries.
Parameters
----------
kind : {'block', 'integer'}, default 'block'
fill_value : float, defaults to NaN (missing)
Value to use for filling NaN values.
Returns
-------
SparseSeries
Sparse representation of th... | [
"Convert",
"Series",
"to",
"SparseSeries",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1552-L1573 |
20,281 | pandas-dev/pandas | pandas/core/series.py | Series._set_name | def _set_name(self, name, inplace=False):
"""
Set the Series name.
Parameters
----------
name : str
inplace : bool
whether to modify `self` directly or return a copy
"""
inplace = validate_bool_kwarg(inplace, 'inplace')
ser = self if i... | python | def _set_name(self, name, inplace=False):
"""
Set the Series name.
Parameters
----------
name : str
inplace : bool
whether to modify `self` directly or return a copy
"""
inplace = validate_bool_kwarg(inplace, 'inplace')
ser = self if i... | [
"def",
"_set_name",
"(",
"self",
",",
"name",
",",
"inplace",
"=",
"False",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",",
"'inplace'",
")",
"ser",
"=",
"self",
"if",
"inplace",
"else",
"self",
".",
"copy",
"(",
")",
"ser",
".",
... | Set the Series name.
Parameters
----------
name : str
inplace : bool
whether to modify `self` directly or return a copy | [
"Set",
"the",
"Series",
"name",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1575-L1588 |
20,282 | pandas-dev/pandas | pandas/core/series.py | Series.drop_duplicates | def drop_duplicates(self, keep='first', inplace=False):
"""
Return Series with duplicate values removed.
Parameters
----------
keep : {'first', 'last', ``False``}, default 'first'
- 'first' : Drop duplicates except for the first occurrence.
- 'last' : Dro... | python | def drop_duplicates(self, keep='first', inplace=False):
"""
Return Series with duplicate values removed.
Parameters
----------
keep : {'first', 'last', ``False``}, default 'first'
- 'first' : Drop duplicates except for the first occurrence.
- 'last' : Dro... | [
"def",
"drop_duplicates",
"(",
"self",
",",
"keep",
"=",
"'first'",
",",
"inplace",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"drop_duplicates",
"(",
"keep",
"=",
"keep",
",",
"inplace",
"=",
"inplace",
")"
] | Return Series with duplicate values removed.
Parameters
----------
keep : {'first', 'last', ``False``}, default 'first'
- 'first' : Drop duplicates except for the first occurrence.
- 'last' : Drop duplicates except for the last occurrence.
- ``False`` : Drop ... | [
"Return",
"Series",
"with",
"duplicate",
"values",
"removed",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1720-L1792 |
20,283 | pandas-dev/pandas | pandas/core/series.py | Series.idxmin | def idxmin(self, axis=0, skipna=True, *args, **kwargs):
"""
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA... | python | def idxmin(self, axis=0, skipna=True, *args, **kwargs):
"""
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA... | [
"def",
"idxmin",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"skipna",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"skipna",
"=",
"nv",
".",
"validate_argmin_with_skipna",
"(",
"skipna",
",",
"args",
",",
"kwargs",
")",
"i",
"=",... | Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA/null values. If the entire Series is NA, the result
will be NA.... | [
"Return",
"the",
"row",
"label",
"of",
"the",
"minimum",
"value",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1870-L1938 |
20,284 | pandas-dev/pandas | pandas/core/series.py | Series.idxmax | def idxmax(self, axis=0, skipna=True, *args, **kwargs):
"""
Return the row label of the maximum value.
If multiple values equal the maximum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA... | python | def idxmax(self, axis=0, skipna=True, *args, **kwargs):
"""
Return the row label of the maximum value.
If multiple values equal the maximum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA... | [
"def",
"idxmax",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"skipna",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"skipna",
"=",
"nv",
".",
"validate_argmax_with_skipna",
"(",
"skipna",
",",
"args",
",",
"kwargs",
")",
"i",
"=",... | Return the row label of the maximum value.
If multiple values equal the maximum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA/null values. If the entire Series is NA, the result
will be NA.... | [
"Return",
"the",
"row",
"label",
"of",
"the",
"maximum",
"value",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1940-L2009 |
20,285 | pandas-dev/pandas | pandas/core/series.py | Series.round | def round(self, decimals=0, *args, **kwargs):
"""
Round each value in a Series to the given number of decimals.
Parameters
----------
decimals : int
Number of decimal places to round to (default: 0).
If decimals is negative, it specifies the number of
... | python | def round(self, decimals=0, *args, **kwargs):
"""
Round each value in a Series to the given number of decimals.
Parameters
----------
decimals : int
Number of decimal places to round to (default: 0).
If decimals is negative, it specifies the number of
... | [
"def",
"round",
"(",
"self",
",",
"decimals",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_round",
"(",
"args",
",",
"kwargs",
")",
"result",
"=",
"com",
".",
"values_from_object",
"(",
"self",
")",
".",
"roun... | Round each value in a Series to the given number of decimals.
Parameters
----------
decimals : int
Number of decimal places to round to (default: 0).
If decimals is negative, it specifies the number of
positions to the left of the decimal point.
Retu... | [
"Round",
"each",
"value",
"in",
"a",
"Series",
"to",
"the",
"given",
"number",
"of",
"decimals",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2033-L2067 |
20,286 | pandas-dev/pandas | pandas/core/series.py | Series.quantile | def quantile(self, q=0.5, interpolation='linear'):
"""
Return value at the given quantile.
Parameters
----------
q : float or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute.
interpolation : {'linear', 'lower', 'higher', 'midpoi... | python | def quantile(self, q=0.5, interpolation='linear'):
"""
Return value at the given quantile.
Parameters
----------
q : float or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute.
interpolation : {'linear', 'lower', 'higher', 'midpoi... | [
"def",
"quantile",
"(",
"self",
",",
"q",
"=",
"0.5",
",",
"interpolation",
"=",
"'linear'",
")",
":",
"self",
".",
"_check_percentile",
"(",
"q",
")",
"# We dispatch to DataFrame so that core.internals only has to worry",
"# about 2D cases.",
"df",
"=",
"self",
".... | Return value at the given quantile.
Parameters
----------
q : float or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute.
interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
.. versionadded:: 0.18.0
This ... | [
"Return",
"value",
"at",
"the",
"given",
"quantile",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2069-L2132 |
20,287 | pandas-dev/pandas | pandas/core/series.py | Series.corr | def corr(self, other, method='pearson', min_periods=None):
"""
Compute correlation with `other` Series, excluding missing values.
Parameters
----------
other : Series
Series with which to compute the correlation.
method : {'pearson', 'kendall', 'spearman'} or... | python | def corr(self, other, method='pearson', min_periods=None):
"""
Compute correlation with `other` Series, excluding missing values.
Parameters
----------
other : Series
Series with which to compute the correlation.
method : {'pearson', 'kendall', 'spearman'} or... | [
"def",
"corr",
"(",
"self",
",",
"other",
",",
"method",
"=",
"'pearson'",
",",
"min_periods",
"=",
"None",
")",
":",
"this",
",",
"other",
"=",
"self",
".",
"align",
"(",
"other",
",",
"join",
"=",
"'inner'",
",",
"copy",
"=",
"False",
")",
"if",
... | Compute correlation with `other` Series, excluding missing values.
Parameters
----------
other : Series
Series with which to compute the correlation.
method : {'pearson', 'kendall', 'spearman'} or callable
* pearson : standard correlation coefficient
... | [
"Compute",
"correlation",
"with",
"other",
"Series",
"excluding",
"missing",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2134-L2180 |
20,288 | pandas-dev/pandas | pandas/core/series.py | Series.cov | def cov(self, other, min_periods=None):
"""
Compute covariance with Series, excluding missing values.
Parameters
----------
other : Series
Series with which to compute the covariance.
min_periods : int, optional
Minimum number of observations need... | python | def cov(self, other, min_periods=None):
"""
Compute covariance with Series, excluding missing values.
Parameters
----------
other : Series
Series with which to compute the covariance.
min_periods : int, optional
Minimum number of observations need... | [
"def",
"cov",
"(",
"self",
",",
"other",
",",
"min_periods",
"=",
"None",
")",
":",
"this",
",",
"other",
"=",
"self",
".",
"align",
"(",
"other",
",",
"join",
"=",
"'inner'",
",",
"copy",
"=",
"False",
")",
"if",
"len",
"(",
"this",
")",
"==",
... | Compute covariance with Series, excluding missing values.
Parameters
----------
other : Series
Series with which to compute the covariance.
min_periods : int, optional
Minimum number of observations needed to have a valid result.
Returns
-------
... | [
"Compute",
"covariance",
"with",
"Series",
"excluding",
"missing",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2182-L2210 |
20,289 | pandas-dev/pandas | pandas/core/series.py | Series.dot | def dot(self, other):
"""
Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also... | python | def dot(self, other):
"""
Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also... | [
"def",
"dot",
"(",
"self",
",",
"other",
")",
":",
"from",
"pandas",
".",
"core",
".",
"frame",
"import",
"DataFrame",
"if",
"isinstance",
"(",
"other",
",",
"(",
"Series",
",",
"DataFrame",
")",
")",
":",
"common",
"=",
"self",
".",
"index",
".",
... | Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also be called using `self @ other` in Python ... | [
"Compute",
"the",
"dot",
"product",
"between",
"the",
"Series",
"and",
"the",
"columns",
"of",
"other",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2321-L2397 |
20,290 | pandas-dev/pandas | pandas/core/series.py | Series.append | def append(self, to_append, ignore_index=False, verify_integrity=False):
"""
Concatenate two or more Series.
Parameters
----------
to_append : Series or list/tuple of Series
Series to append with self.
ignore_index : bool, default False
If True, d... | python | def append(self, to_append, ignore_index=False, verify_integrity=False):
"""
Concatenate two or more Series.
Parameters
----------
to_append : Series or list/tuple of Series
Series to append with self.
ignore_index : bool, default False
If True, d... | [
"def",
"append",
"(",
"self",
",",
"to_append",
",",
"ignore_index",
"=",
"False",
",",
"verify_integrity",
"=",
"False",
")",
":",
"from",
"pandas",
".",
"core",
".",
"reshape",
".",
"concat",
"import",
"concat",
"if",
"isinstance",
"(",
"to_append",
",",... | Concatenate two or more Series.
Parameters
----------
to_append : Series or list/tuple of Series
Series to append with self.
ignore_index : bool, default False
If True, do not use the index labels.
.. versionadded:: 0.19.0
verify_integrity :... | [
"Concatenate",
"two",
"or",
"more",
"Series",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2420-L2501 |
20,291 | pandas-dev/pandas | pandas/core/series.py | Series._binop | def _binop(self, other, func, level=None, fill_value=None):
"""
Perform generic binary operation with optional fill value.
Parameters
----------
other : Series
func : binary operator
fill_value : float or object
Value to substitute for NA/null values.... | python | def _binop(self, other, func, level=None, fill_value=None):
"""
Perform generic binary operation with optional fill value.
Parameters
----------
other : Series
func : binary operator
fill_value : float or object
Value to substitute for NA/null values.... | [
"def",
"_binop",
"(",
"self",
",",
"other",
",",
"func",
",",
"level",
"=",
"None",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Series",
")",
":",
"raise",
"AssertionError",
"(",
"'Other operand must be Series'"... | Perform generic binary operation with optional fill value.
Parameters
----------
other : Series
func : binary operator
fill_value : float or object
Value to substitute for NA/null values. If both Series are NA in a
location, the result will be NA regardle... | [
"Perform",
"generic",
"binary",
"operation",
"with",
"optional",
"fill",
"value",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2503-L2545 |
20,292 | pandas-dev/pandas | pandas/core/series.py | Series.combine | def combine(self, other, func, fill_value=None):
"""
Combine the Series with a Series or scalar according to `func`.
Combine the Series and `other` using `func` to perform elementwise
selection for combined Series.
`fill_value` is assumed when value is missing at some index
... | python | def combine(self, other, func, fill_value=None):
"""
Combine the Series with a Series or scalar according to `func`.
Combine the Series and `other` using `func` to perform elementwise
selection for combined Series.
`fill_value` is assumed when value is missing at some index
... | [
"def",
"combine",
"(",
"self",
",",
"other",
",",
"func",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"fill_value",
"is",
"None",
":",
"fill_value",
"=",
"na_value_for_dtype",
"(",
"self",
".",
"dtype",
",",
"compat",
"=",
"False",
")",
"if",
"isin... | Combine the Series with a Series or scalar according to `func`.
Combine the Series and `other` using `func` to perform elementwise
selection for combined Series.
`fill_value` is assumed when value is missing at some index
from one of the two objects being combined.
Parameters
... | [
"Combine",
"the",
"Series",
"with",
"a",
"Series",
"or",
"scalar",
"according",
"to",
"func",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2547-L2650 |
20,293 | pandas-dev/pandas | pandas/core/series.py | Series.combine_first | def combine_first(self, other):
"""
Combine Series values, choosing the calling Series's values first.
Parameters
----------
other : Series
The value(s) to be combined with the `Series`.
Returns
-------
Series
The result of combin... | python | def combine_first(self, other):
"""
Combine Series values, choosing the calling Series's values first.
Parameters
----------
other : Series
The value(s) to be combined with the `Series`.
Returns
-------
Series
The result of combin... | [
"def",
"combine_first",
"(",
"self",
",",
"other",
")",
":",
"new_index",
"=",
"self",
".",
"index",
".",
"union",
"(",
"other",
".",
"index",
")",
"this",
"=",
"self",
".",
"reindex",
"(",
"new_index",
",",
"copy",
"=",
"False",
")",
"other",
"=",
... | Combine Series values, choosing the calling Series's values first.
Parameters
----------
other : Series
The value(s) to be combined with the `Series`.
Returns
-------
Series
The result of combining the Series with the other object.
See A... | [
"Combine",
"Series",
"values",
"choosing",
"the",
"calling",
"Series",
"s",
"values",
"first",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2652-L2690 |
20,294 | pandas-dev/pandas | pandas/core/series.py | Series.update | def update(self, other):
"""
Modify Series in place using non-NA values from passed
Series. Aligns on index.
Parameters
----------
other : Series
Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, 5, 6]))
>>... | python | def update(self, other):
"""
Modify Series in place using non-NA values from passed
Series. Aligns on index.
Parameters
----------
other : Series
Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, 5, 6]))
>>... | [
"def",
"update",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"other",
".",
"reindex_like",
"(",
"self",
")",
"mask",
"=",
"notna",
"(",
"other",
")",
"self",
".",
"_data",
"=",
"self",
".",
"_data",
".",
"putmask",
"(",
"mask",
"=",
"mask",
... | Modify Series in place using non-NA values from passed
Series. Aligns on index.
Parameters
----------
other : Series
Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, 5, 6]))
>>> s
0 4
1 5
2 ... | [
"Modify",
"Series",
"in",
"place",
"using",
"non",
"-",
"NA",
"values",
"from",
"passed",
"Series",
".",
"Aligns",
"on",
"index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2692-L2742 |
20,295 | pandas-dev/pandas | pandas/core/series.py | Series.sort_values | def sort_values(self, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
"""
Sort by the values.
Sort a Series in ascending or descending order by some
criterion.
Parameters
----------
axis : {0 or 'index'}, default... | python | def sort_values(self, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
"""
Sort by the values.
Sort a Series in ascending or descending order by some
criterion.
Parameters
----------
axis : {0 or 'index'}, default... | [
"def",
"sort_values",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"ascending",
"=",
"True",
",",
"inplace",
"=",
"False",
",",
"kind",
"=",
"'quicksort'",
",",
"na_position",
"=",
"'last'",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",... | Sort by the values.
Sort a Series in ascending or descending order by some
criterion.
Parameters
----------
axis : {0 or 'index'}, default 0
Axis to direct sorting. The value 'index' is accepted for
compatibility with DataFrame.sort_values.
ascen... | [
"Sort",
"by",
"the",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2747-L2910 |
20,296 | pandas-dev/pandas | pandas/core/series.py | Series.sort_index | def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
kind='quicksort', na_position='last', sort_remaining=True):
"""
Sort Series by index labels.
Returns a new Series sorted by label if `inplace` argument is
``False``, otherwise updates the original... | python | def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
kind='quicksort', na_position='last', sort_remaining=True):
"""
Sort Series by index labels.
Returns a new Series sorted by label if `inplace` argument is
``False``, otherwise updates the original... | [
"def",
"sort_index",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"ascending",
"=",
"True",
",",
"inplace",
"=",
"False",
",",
"kind",
"=",
"'quicksort'",
",",
"na_position",
"=",
"'last'",
",",
"sort_remaining",
"=",
"True",
")"... | Sort Series by index labels.
Returns a new Series sorted by label if `inplace` argument is
``False``, otherwise updates the original series and returns None.
Parameters
----------
axis : int, default 0
Axis to direct sorting. This can only be 0 for Series.
l... | [
"Sort",
"Series",
"by",
"index",
"labels",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2912-L3065 |
20,297 | pandas-dev/pandas | pandas/core/series.py | Series.nlargest | def nlargest(self, n=5, keep='first'):
"""
Return the largest `n` elements.
Parameters
----------
n : int, default 5
Return this many descending sorted values.
keep : {'first', 'last', 'all'}, default 'first'
When there are duplicate values that c... | python | def nlargest(self, n=5, keep='first'):
"""
Return the largest `n` elements.
Parameters
----------
n : int, default 5
Return this many descending sorted values.
keep : {'first', 'last', 'all'}, default 'first'
When there are duplicate values that c... | [
"def",
"nlargest",
"(",
"self",
",",
"n",
"=",
"5",
",",
"keep",
"=",
"'first'",
")",
":",
"return",
"algorithms",
".",
"SelectNSeries",
"(",
"self",
",",
"n",
"=",
"n",
",",
"keep",
"=",
"keep",
")",
".",
"nlargest",
"(",
")"
] | Return the largest `n` elements.
Parameters
----------
n : int, default 5
Return this many descending sorted values.
keep : {'first', 'last', 'all'}, default 'first'
When there are duplicate values that cannot all fit in a
Series of `n` elements:
... | [
"Return",
"the",
"largest",
"n",
"elements",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3107-L3203 |
20,298 | pandas-dev/pandas | pandas/core/series.py | Series.nsmallest | def nsmallest(self, n=5, keep='first'):
"""
Return the smallest `n` elements.
Parameters
----------
n : int, default 5
Return this many ascending sorted values.
keep : {'first', 'last', 'all'}, default 'first'
When there are duplicate values that ... | python | def nsmallest(self, n=5, keep='first'):
"""
Return the smallest `n` elements.
Parameters
----------
n : int, default 5
Return this many ascending sorted values.
keep : {'first', 'last', 'all'}, default 'first'
When there are duplicate values that ... | [
"def",
"nsmallest",
"(",
"self",
",",
"n",
"=",
"5",
",",
"keep",
"=",
"'first'",
")",
":",
"return",
"algorithms",
".",
"SelectNSeries",
"(",
"self",
",",
"n",
"=",
"n",
",",
"keep",
"=",
"keep",
")",
".",
"nsmallest",
"(",
")"
] | Return the smallest `n` elements.
Parameters
----------
n : int, default 5
Return this many ascending sorted values.
keep : {'first', 'last', 'all'}, default 'first'
When there are duplicate values that cannot all fit in a
Series of `n` elements:
... | [
"Return",
"the",
"smallest",
"n",
"elements",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3205-L3300 |
20,299 | pandas-dev/pandas | pandas/core/series.py | Series.swaplevel | def swaplevel(self, i=-2, j=-1, copy=True):
"""
Swap levels i and j in a MultiIndex.
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
Series
Series w... | python | def swaplevel(self, i=-2, j=-1, copy=True):
"""
Swap levels i and j in a MultiIndex.
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
Series
Series w... | [
"def",
"swaplevel",
"(",
"self",
",",
"i",
"=",
"-",
"2",
",",
"j",
"=",
"-",
"1",
",",
"copy",
"=",
"True",
")",
":",
"new_index",
"=",
"self",
".",
"index",
".",
"swaplevel",
"(",
"i",
",",
"j",
")",
"return",
"self",
".",
"_constructor",
"("... | Swap levels i and j in a MultiIndex.
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
Series
Series with levels swapped in MultiIndex.
.. versionchanged:: 0... | [
"Swap",
"levels",
"i",
"and",
"j",
"in",
"a",
"MultiIndex",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3302-L3323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.