partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
NDFrame.get
Get item from object for given key (DataFrame column, Panel slice, etc.). Returns default value if not found. Parameters ---------- key : object Returns ------- value : same type as items contained in object
pandas/core/generic.py
def get(self, key, default=None): """ Get item from object for given key (DataFrame column, Panel slice, etc.). Returns default value if not found. Parameters ---------- key : object Returns ------- value : same type as items contained in object ...
def get(self, key, default=None): """ Get item from object for given key (DataFrame column, Panel slice, etc.). Returns default value if not found. Parameters ---------- key : object Returns ------- value : same type as items contained in object ...
[ "Get", "item", "from", "object", "for", "given", "key", "(", "DataFrame", "column", "Panel", "slice", "etc", ".", ")", ".", "Returns", "default", "value", "if", "not", "found", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3065-L3081
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", "[", "key", "]", "except", "(", "KeyError", ",", "ValueError", ",", "IndexError", ")", ":", "return", "default" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._get_item_cache
Return the cached item, item represents a label indexer.
pandas/core/generic.py
def _get_item_cache(self, item): """Return the cached item, item represents a label indexer.""" cache = self._item_cache res = cache.get(item) if res is None: values = self._data.get(item) res = self._box_item_values(item, values) cache[item] = res ...
def _get_item_cache(self, item): """Return the cached item, item represents a label indexer.""" cache = self._item_cache res = cache.get(item) if res is None: values = self._data.get(item) res = self._box_item_values(item, values) cache[item] = res ...
[ "Return", "the", "cached", "item", "item", "represents", "a", "label", "indexer", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3086-L3098
[ "def", "_get_item_cache", "(", "self", ",", "item", ")", ":", "cache", "=", "self", ".", "_item_cache", "res", "=", "cache", ".", "get", "(", "item", ")", "if", "res", "is", "None", ":", "values", "=", "self", ".", "_data", ".", "get", "(", "item",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._set_as_cached
Set the _cacher attribute on the calling object with a weakref to cacher.
pandas/core/generic.py
def _set_as_cached(self, item, cacher): """Set the _cacher attribute on the calling object with a weakref to cacher. """ self._cacher = (item, weakref.ref(cacher))
def _set_as_cached(self, item, cacher): """Set the _cacher attribute on the calling object with a weakref to cacher. """ self._cacher = (item, weakref.ref(cacher))
[ "Set", "the", "_cacher", "attribute", "on", "the", "calling", "object", "with", "a", "weakref", "to", "cacher", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3100-L3104
[ "def", "_set_as_cached", "(", "self", ",", "item", ",", "cacher", ")", ":", "self", ".", "_cacher", "=", "(", "item", ",", "weakref", ".", "ref", "(", "cacher", ")", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._iget_item_cache
Return the cached item, item represents a positional indexer.
pandas/core/generic.py
def _iget_item_cache(self, item): """Return the cached item, item represents a positional indexer.""" ax = self._info_axis if ax.is_unique: lower = self._get_item_cache(ax[item]) else: lower = self._take(item, axis=self._info_axis_number) return lower
def _iget_item_cache(self, item): """Return the cached item, item represents a positional indexer.""" ax = self._info_axis if ax.is_unique: lower = self._get_item_cache(ax[item]) else: lower = self._take(item, axis=self._info_axis_number) return lower
[ "Return", "the", "cached", "item", "item", "represents", "a", "positional", "indexer", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3111-L3118
[ "def", "_iget_item_cache", "(", "self", ",", "item", ")", ":", "ax", "=", "self", ".", "_info_axis", "if", "ax", ".", "is_unique", ":", "lower", "=", "self", ".", "_get_item_cache", "(", "ax", "[", "item", "]", ")", "else", ":", "lower", "=", "self",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._maybe_update_cacher
See if we need to update our parent cacher if clear, then clear our cache. Parameters ---------- clear : boolean, default False clear the item cache verify_is_copy : boolean, default True provide is_copy checks
pandas/core/generic.py
def _maybe_update_cacher(self, clear=False, verify_is_copy=True): """ See if we need to update our parent cacher if clear, then clear our cache. Parameters ---------- clear : boolean, default False clear the item cache verify_is_copy : boolean, defaul...
def _maybe_update_cacher(self, clear=False, verify_is_copy=True): """ See if we need to update our parent cacher if clear, then clear our cache. Parameters ---------- clear : boolean, default False clear the item cache verify_is_copy : boolean, defaul...
[ "See", "if", "we", "need", "to", "update", "our", "parent", "cacher", "if", "clear", "then", "clear", "our", "cache", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3145-L3177
[ "def", "_maybe_update_cacher", "(", "self", ",", "clear", "=", "False", ",", "verify_is_copy", "=", "True", ")", ":", "cacher", "=", "getattr", "(", "self", ",", "'_cacher'", ",", "None", ")", "if", "cacher", "is", "not", "None", ":", "ref", "=", "cach...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._slice
Construct a slice of this container. kind parameter is maintained for compatibility with Series slicing.
pandas/core/generic.py
def _slice(self, slobj, axis=0, kind=None): """ Construct a slice of this container. kind parameter is maintained for compatibility with Series slicing. """ axis = self._get_block_manager_axis(axis) result = self._constructor(self._data.get_slice(slobj, axis=axis)) ...
def _slice(self, slobj, axis=0, kind=None): """ Construct a slice of this container. kind parameter is maintained for compatibility with Series slicing. """ axis = self._get_block_manager_axis(axis) result = self._constructor(self._data.get_slice(slobj, axis=axis)) ...
[ "Construct", "a", "slice", "of", "this", "container", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3185-L3199
[ "def", "_slice", "(", "self", ",", "slobj", ",", "axis", "=", "0", ",", "kind", "=", "None", ")", ":", "axis", "=", "self", ".", "_get_block_manager_axis", "(", "axis", ")", "result", "=", "self", ".", "_constructor", "(", "self", ".", "_data", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._check_is_chained_assignment_possible
Check if we are a view, have a cacher, and are of mixed type. If so, then force a setitem_copy check. Should be called just near setting a value Will return a boolean if it we are a view and are cached, but a single-dtype meaning that the cacher should be updated following sett...
pandas/core/generic.py
def _check_is_chained_assignment_possible(self): """ Check if we are a view, have a cacher, and are of mixed type. If so, then force a setitem_copy check. Should be called just near setting a value Will return a boolean if it we are a view and are cached, but a single-d...
def _check_is_chained_assignment_possible(self): """ Check if we are a view, have a cacher, and are of mixed type. If so, then force a setitem_copy check. Should be called just near setting a value Will return a boolean if it we are a view and are cached, but a single-d...
[ "Check", "if", "we", "are", "a", "view", "have", "a", "cacher", "and", "are", "of", "mixed", "type", ".", "If", "so", "then", "force", "a", "setitem_copy", "check", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3214-L3233
[ "def", "_check_is_chained_assignment_possible", "(", "self", ")", ":", "if", "self", ".", "_is_view", "and", "self", ".", "_is_cached", ":", "ref", "=", "self", ".", "_get_cacher", "(", ")", "if", "ref", "is", "not", "None", "and", "ref", ".", "_is_mixed_t...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._take
Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the element in the object. This is the internal version of ``.ta...
pandas/core/generic.py
def _take(self, indices, axis=0, is_copy=True): """ Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the e...
def _take(self, indices, axis=0, is_copy=True): """ Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the e...
[ "Return", "the", "elements", "in", "the", "given", "*", "positional", "*", "indices", "along", "an", "axis", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3353-L3397
[ "def", "_take", "(", "self", ",", "indices", ",", "axis", "=", "0", ",", "is_copy", "=", "True", ")", ":", "self", ".", "_consolidate_inplace", "(", ")", "new_data", "=", "self", ".", "_data", ".", "take", "(", "indices", ",", "axis", "=", "self", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.take
Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the element in the object. Parameters ---------- ...
pandas/core/generic.py
def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs): """ Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the a...
def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs): """ Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the a...
[ "Return", "the", "elements", "in", "the", "given", "*", "positional", "*", "indices", "along", "an", "axis", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3399-L3489
[ "def", "take", "(", "self", ",", "indices", ",", "axis", "=", "0", ",", "convert", "=", "None", ",", "is_copy", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "convert", "is", "not", "None", ":", "msg", "=", "(", "\"The 'convert' parameter is ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.xs
Return cross-section from the Series/DataFrame. This method takes a `key` argument to select data at a particular level of a MultiIndex. Parameters ---------- key : label or tuple of label Label contained in the index, or partially in a MultiIndex. axis : {0...
pandas/core/generic.py
def xs(self, key, axis=0, level=None, drop_level=True): """ Return cross-section from the Series/DataFrame. This method takes a `key` argument to select data at a particular level of a MultiIndex. Parameters ---------- key : label or tuple of label L...
def xs(self, key, axis=0, level=None, drop_level=True): """ Return cross-section from the Series/DataFrame. This method takes a `key` argument to select data at a particular level of a MultiIndex. Parameters ---------- key : label or tuple of label L...
[ "Return", "cross", "-", "section", "from", "the", "Series", "/", "DataFrame", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3491-L3649
[ "def", "xs", "(", "self", ",", "key", ",", "axis", "=", "0", ",", "level", "=", "None", ",", "drop_level", "=", "True", ")", ":", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "labels", "=", "self", ".", "_get_axis", "(", "axis", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.select
Return data corresponding to axis labels matching criteria. .. deprecated:: 0.21.0 Use df.loc[df.index.map(crit)] to select via labels Parameters ---------- crit : function To be called on each index (label). Should return True or False axis : int ...
pandas/core/generic.py
def select(self, crit, axis=0): """ Return data corresponding to axis labels matching criteria. .. deprecated:: 0.21.0 Use df.loc[df.index.map(crit)] to select via labels Parameters ---------- crit : function To be called on each index (label). S...
def select(self, crit, axis=0): """ Return data corresponding to axis labels matching criteria. .. deprecated:: 0.21.0 Use df.loc[df.index.map(crit)] to select via labels Parameters ---------- crit : function To be called on each index (label). S...
[ "Return", "data", "corresponding", "to", "axis", "labels", "matching", "criteria", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3653-L3685
[ "def", "select", "(", "self", ",", "crit", ",", "axis", "=", "0", ")", ":", "warnings", ".", "warn", "(", "\"'select' is deprecated and will be removed in a \"", "\"future release. You can use \"", "\".loc[labels.map(crit)] as a replacement\"", ",", "FutureWarning", ",", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.reindex_like
Return an object with matching indices as other object. Conform the object to the same index on all axes. Optional filling logic, placing NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and copy=False...
pandas/core/generic.py
def reindex_like(self, other, method=None, copy=True, limit=None, tolerance=None): """ Return an object with matching indices as other object. Conform the object to the same index on all axes. Optional filling logic, placing NaN in locations having no value ...
def reindex_like(self, other, method=None, copy=True, limit=None, tolerance=None): """ Return an object with matching indices as other object. Conform the object to the same index on all axes. Optional filling logic, placing NaN in locations having no value ...
[ "Return", "an", "object", "with", "matching", "indices", "as", "other", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3687-L3787
[ "def", "reindex_like", "(", "self", ",", "other", ",", "method", "=", "None", ",", "copy", "=", "True", ",", "limit", "=", "None", ",", "tolerance", "=", "None", ")", ":", "d", "=", "other", ".", "_construct_axes_dict", "(", "axes", "=", "self", ".",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._drop_axis
Drop labels from specified axis. Used in the ``drop`` method internally. Parameters ---------- labels : single label or list-like axis : int or axis name level : int or level name, default None For MultiIndex errors : {'ignore', 'raise'}, default 'rai...
pandas/core/generic.py
def _drop_axis(self, labels, axis, level=None, errors='raise'): """ Drop labels from specified axis. Used in the ``drop`` method internally. Parameters ---------- labels : single label or list-like axis : int or axis name level : int or level name, defaul...
def _drop_axis(self, labels, axis, level=None, errors='raise'): """ Drop labels from specified axis. Used in the ``drop`` method internally. Parameters ---------- labels : single label or list-like axis : int or axis name level : int or level name, defaul...
[ "Drop", "labels", "from", "specified", "axis", ".", "Used", "in", "the", "drop", "method", "internally", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3817-L3868
[ "def", "_drop_axis", "(", "self", ",", "labels", ",", "axis", ",", "level", "=", "None", ",", "errors", "=", "'raise'", ")", ":", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "axis_name", "=", "self", ".", "_get_axis_name", "(", "axi...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._update_inplace
Replace self internals with result. Parameters ---------- verify_is_copy : boolean, default True provide is_copy checks
pandas/core/generic.py
def _update_inplace(self, result, verify_is_copy=True): """ Replace self internals with result. Parameters ---------- verify_is_copy : boolean, default True provide is_copy checks """ # NOTE: This does *not* call __finalize__ and that's an explicit ...
def _update_inplace(self, result, verify_is_copy=True): """ Replace self internals with result. Parameters ---------- verify_is_copy : boolean, default True provide is_copy checks """ # NOTE: This does *not* call __finalize__ and that's an explicit ...
[ "Replace", "self", "internals", "with", "result", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3870-L3886
[ "def", "_update_inplace", "(", "self", ",", "result", ",", "verify_is_copy", "=", "True", ")", ":", "# NOTE: This does *not* call __finalize__ and that's an explicit", "# decision that we may revisit in the future.", "self", ".", "_reset_cache", "(", ")", "self", ".", "_cle...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.add_prefix
Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add before each label. Returns ------- Series or DataFrame ...
pandas/core/generic.py
def add_prefix(self, prefix): """ Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add before each label. Returns ...
def add_prefix(self, prefix): """ Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add before each label. Returns ...
[ "Prefix", "labels", "with", "string", "prefix", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3888-L3945
[ "def", "add_prefix", "(", "self", ",", "prefix", ")", ":", "f", "=", "functools", ".", "partial", "(", "'{prefix}{}'", ".", "format", ",", "prefix", "=", "prefix", ")", "mapper", "=", "{", "self", ".", "_info_axis_name", ":", "f", "}", "return", "self"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.add_suffix
Suffix labels with string `suffix`. For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed. Parameters ---------- suffix : str The string to add after each label. Returns ------- Series or DataFrame ...
pandas/core/generic.py
def add_suffix(self, suffix): """ Suffix labels with string `suffix`. For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed. Parameters ---------- suffix : str The string to add after each label. Returns ...
def add_suffix(self, suffix): """ Suffix labels with string `suffix`. For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed. Parameters ---------- suffix : str The string to add after each label. Returns ...
[ "Suffix", "labels", "with", "string", "suffix", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3947-L4004
[ "def", "add_suffix", "(", "self", ",", "suffix", ")", ":", "f", "=", "functools", ".", "partial", "(", "'{}{suffix}'", ".", "format", ",", "suffix", "=", "suffix", ")", "mapper", "=", "{", "self", ".", "_info_axis_name", ":", "f", "}", "return", "self"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.sort_values
Sort by the values along either axis. Parameters ----------%(optional_by)s axis : %(axes_single_arg)s, default 0 Axis to be sorted. ascending : bool or list of bool, default True Sort ascending vs. descending. Specify list for multiple sort orders....
pandas/core/generic.py
def sort_values(self, by=None, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'): """ Sort by the values along either axis. Parameters ----------%(optional_by)s axis : %(axes_single_arg)s, default 0 Axis to be sorted. ...
def sort_values(self, by=None, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'): """ Sort by the values along either axis. Parameters ----------%(optional_by)s axis : %(axes_single_arg)s, default 0 Axis to be sorted. ...
[ "Sort", "by", "the", "values", "along", "either", "axis", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4006-L4096
[ "def", "sort_values", "(", "self", ",", "by", "=", "None", ",", "axis", "=", "0", ",", "ascending", "=", "True", ",", "inplace", "=", "False", ",", "kind", "=", "'quicksort'", ",", "na_position", "=", "'last'", ")", ":", "raise", "NotImplementedError", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.sort_index
Sort object by labels (along an axis). Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 The axis along which to sort. The value 0 identifies the rows, and 1 identifies the columns. level : int or level name or list of ints or list of level ...
pandas/core/generic.py
def sort_index(self, axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True): """ Sort object by labels (along an axis). Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 Th...
def sort_index(self, axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True): """ Sort object by labels (along an axis). Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 Th...
[ "Sort", "object", "by", "labels", "(", "along", "an", "axis", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4098-L4146
[ "def", "sort_index", "(", "self", ",", "axis", "=", "0", ",", "level", "=", "None", ",", "ascending", "=", "True", ",", "inplace", "=", "False", ",", "kind", "=", "'quicksort'", ",", "na_position", "=", "'last'", ",", "sort_remaining", "=", "True", ")"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.reindex
Conform %(klass)s to new index with optional filling logic, placing NA/NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and ``copy=False``. Parameters ---------- %(optional_labels)s ...
pandas/core/generic.py
def reindex(self, *args, **kwargs): """ Conform %(klass)s to new index with optional filling logic, placing NA/NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and ``copy=False``. Param...
def reindex(self, *args, **kwargs): """ Conform %(klass)s to new index with optional filling logic, placing NA/NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and ``copy=False``. Param...
[ "Conform", "%", "(", "klass", ")", "s", "to", "new", "index", "with", "optional", "filling", "logic", "placing", "NA", "/", "NaN", "in", "locations", "having", "no", "value", "in", "the", "previous", "index", ".", "A", "new", "object", "is", "produced", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4148-L4391
[ "def", "reindex", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: Decide if we care about having different examples for different", "# kinds", "# construct the args", "axes", ",", "kwargs", "=", "self", ".", "_construct_axes_from_arguments", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._reindex_axes
Perform the reindex for all the axes.
pandas/core/generic.py
def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy): """Perform the reindex for all the axes.""" obj = self for a in self._AXIS_ORDERS: labels = axes[a] if labels is None: continue ax = self._...
def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy): """Perform the reindex for all the axes.""" obj = self for a in self._AXIS_ORDERS: labels = axes[a] if labels is None: continue ax = self._...
[ "Perform", "the", "reindex", "for", "all", "the", "axes", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4393-L4411
[ "def", "_reindex_axes", "(", "self", ",", "axes", ",", "level", ",", "limit", ",", "tolerance", ",", "method", ",", "fill_value", ",", "copy", ")", ":", "obj", "=", "self", "for", "a", "in", "self", ".", "_AXIS_ORDERS", ":", "labels", "=", "axes", "[...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._needs_reindex_multi
Check if we do need a multi reindex.
pandas/core/generic.py
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): """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)
[ "Check", "if", "we", "do", "need", "a", "multi", "reindex", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4413-L4416
[ "def", "_needs_reindex_multi", "(", "self", ",", "axes", ",", "method", ",", "level", ")", ":", "return", "(", "(", "com", ".", "count_not_none", "(", "*", "axes", ".", "values", "(", ")", ")", "==", "self", ".", "_AXIS_LEN", ")", "and", "method", "i...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._reindex_with_indexers
allow_dups indicates an internal call here
pandas/core/generic.py
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): """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...
[ "allow_dups", "indicates", "an", "internal", "call", "here" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4504-L4530
[ "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", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.filter
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...
pandas/core/generic.py
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): """ 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...
[ "Subset", "rows", "or", "columns", "of", "dataframe", "according", "to", "labels", "in", "the", "specified", "index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4532-L4618
[ "def", "filter", "(", "self", ",", "items", "=", "None", ",", "like", "=", "None", ",", "regex", "=", "None", ",", "axis", "=", "None", ")", ":", "import", "re", "nkw", "=", "com", ".", "count_not_none", "(", "items", ",", "like", ",", "regex", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.sample
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...
pandas/core/generic.py
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): """ Return a random sample of items from an axis of object. You can use `random_state` for reproducibility. Parameters ---------- n : int, optional ...
[ "Return", "a", "random", "sample", "of", "items", "from", "an", "axis", "of", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4740-L4901
[ "def", "sample", "(", "self", ",", "n", "=", "None", ",", "frac", "=", "None", ",", "replace", "=", "False", ",", "weights", "=", "None", ",", "random_state", "=", "None", ",", "axis", "=", "None", ")", ":", "if", "axis", "is", "None", ":", "axis...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._dir_additions
add the string-like attributes from the info_axis. If info_axis is a MultiIndex, it's first level values are used.
pandas/core/generic.py
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): """ 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...
[ "add", "the", "string", "-", "like", "attributes", "from", "the", "info_axis", ".", "If", "info_axis", "is", "a", "MultiIndex", "it", "s", "first", "level", "values", "are", "used", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5141-L5147
[ "def", "_dir_additions", "(", "self", ")", ":", "additions", "=", "{", "c", "for", "c", "in", "self", ".", "_info_axis", ".", "unique", "(", "level", "=", "0", ")", "[", ":", "100", "]", "if", "isinstance", "(", "c", ",", "str", ")", "and", "c", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._protect_consolidate
Consolidate _data -- if the blocks have changed, then clear the cache
pandas/core/generic.py
def _protect_consolidate(self, f): """Consolidate _data -- if the blocks have changed, then clear the cache """ blocks_before = len(self._data.blocks) result = f() if len(self._data.blocks) != blocks_before: self._clear_item_cache() return result
def _protect_consolidate(self, f): """Consolidate _data -- if the blocks have changed, then clear the cache """ blocks_before = len(self._data.blocks) result = f() if len(self._data.blocks) != blocks_before: self._clear_item_cache() return result
[ "Consolidate", "_data", "--", "if", "the", "blocks", "have", "changed", "then", "clear", "the", "cache" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5155-L5163
[ "def", "_protect_consolidate", "(", "self", ",", "f", ")", ":", "blocks_before", "=", "len", "(", "self", ".", "_data", ".", "blocks", ")", "result", "=", "f", "(", ")", "if", "len", "(", "self", ".", "_data", ".", "blocks", ")", "!=", "blocks_before...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._consolidate_inplace
Consolidate data in place and return None
pandas/core/generic.py
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): """Consolidate data in place and return None""" def f(): self._data = self._data.consolidate() self._protect_consolidate(f)
[ "Consolidate", "data", "in", "place", "and", "return", "None" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5165-L5171
[ "def", "_consolidate_inplace", "(", "self", ")", ":", "def", "f", "(", ")", ":", "self", ".", "_data", "=", "self", ".", "_data", ".", "consolidate", "(", ")", "self", ".", "_protect_consolidate", "(", "f", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._consolidate
Compute NDFrame with "consolidated" internals (data of each dtype grouped together in a single ndarray). Parameters ---------- inplace : boolean, default False If False return new object, otherwise modify existing object Returns ------- consolidated ...
pandas/core/generic.py
def _consolidate(self, inplace=False): """ Compute NDFrame with "consolidated" internals (data of each dtype grouped together in a single ndarray). Parameters ---------- inplace : boolean, default False If False return new object, otherwise modify existing ob...
def _consolidate(self, inplace=False): """ Compute NDFrame with "consolidated" internals (data of each dtype grouped together in a single ndarray). Parameters ---------- inplace : boolean, default False If False return new object, otherwise modify existing ob...
[ "Compute", "NDFrame", "with", "consolidated", "internals", "(", "data", "of", "each", "dtype", "grouped", "together", "in", "a", "single", "ndarray", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5173-L5193
[ "def", "_consolidate", "(", "self", ",", "inplace", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "if", "inplace", ":", "self", ".", "_consolidate_inplace", "(", ")", "else", ":", "f", "=", "lambda", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._check_inplace_setting
check whether we allow in-place setting with this type of value
pandas/core/generic.py
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): """ 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): ...
[ "check", "whether", "we", "allow", "in", "-", "place", "setting", "with", "this", "type", "of", "value" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5210-L5226
[ "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", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.as_matrix
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 ...
pandas/core/generic.py
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): """ 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...
[ "Convert", "the", "frame", "to", "its", "Numpy", "-", "array", "representation", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5238-L5281
[ "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...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.values
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...
pandas/core/generic.py
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): """ 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...
[ "Return", "a", "Numpy", "representation", "of", "the", "DataFrame", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5284-L5358
[ "def", "values", "(", "self", ")", ":", "self", ".", "_consolidate_inplace", "(", ")", "return", "self", ".", "_data", ".", "as_array", "(", "transpose", "=", "self", ".", "_AXIS_REVERSED", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.get_ftype_counts
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...
pandas/core/generic.py
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): """ 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...
[ "Return", "counts", "of", "unique", "ftypes", "in", "this", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5447-L5488
[ "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", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.dtypes
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 ...
pandas/core/generic.py
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): """ 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...
[ "Return", "the", "dtypes", "in", "the", "DataFrame", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5491-L5524
[ "def", "dtypes", "(", "self", ")", ":", "from", "pandas", "import", "Series", "return", "Series", "(", "self", ".", "_data", ".", "get_dtypes", "(", ")", ",", "index", "=", "self", ".", "_info_axis", ",", "dtype", "=", "np", ".", "object_", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.ftypes
Return the ftypes (indication of sparse/dense and dtype) in DataFrame. This returns a Series with the data type of each column. The result's index is the original DataFrame's columns. Columns with mixed types are stored with the ``object`` dtype. See :ref:`the User Guide <basics.dtypes...
pandas/core/generic.py
def ftypes(self): """ Return the ftypes (indication of sparse/dense and dtype) in DataFrame. This returns a Series with the data type of each column. The result's index is the original DataFrame's columns. Columns with mixed types are stored with the ``object`` dtype. See ...
def ftypes(self): """ Return the ftypes (indication of sparse/dense and dtype) in DataFrame. This returns a Series with the data type of each column. The result's index is the original DataFrame's columns. Columns with mixed types are stored with the ``object`` dtype. See ...
[ "Return", "the", "ftypes", "(", "indication", "of", "sparse", "/", "dense", "and", "dtype", ")", "in", "DataFrame", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5527-L5570
[ "def", "ftypes", "(", "self", ")", ":", "from", "pandas", "import", "Series", "return", "Series", "(", "self", ".", "_data", ".", "get_ftypes", "(", ")", ",", "index", "=", "self", ".", "_info_axis", ",", "dtype", "=", "np", ".", "object_", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.as_blocks
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...
pandas/core/generic.py
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): """ 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 --------...
[ "Convert", "the", "frame", "to", "a", "dict", "of", "dtype", "-", ">", "Constructor", "Types", "that", "each", "has", "a", "homogeneous", "dtype", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5572-L5593
[ "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...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._to_dict_of_blocks
Return a dict of dtype -> Constructor Types that each is a homogeneous dtype. Internal ONLY
pandas/core/generic.py
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 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()}
[ "Return", "a", "dict", "of", "dtype", "-", ">", "Constructor", "Types", "that", "each", "is", "a", "homogeneous", "dtype", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5604-L5612
[ "def", "_to_dict_of_blocks", "(", "self", ",", "copy", "=", "True", ")", ":", "return", "{", "k", ":", "self", ".", "_constructor", "(", "v", ")", ".", "__finalize__", "(", "self", ")", "for", "k", ",", "v", ",", "in", "self", ".", "_data", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.astype
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 ...
pandas/core/generic.py
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): """ 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 ...
[ "Cast", "a", "pandas", "object", "to", "a", "specified", "dtype", "dtype", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5614-L5731
[ "def", "astype", "(", "self", ",", "dtype", ",", "copy", "=", "True", ",", "errors", "=", "'raise'", ",", "*", "*", "kwargs", ")", ":", "if", "is_dict_like", "(", "dtype", ")", ":", "if", "self", ".", "ndim", "==", "1", ":", "# i.e. Series", "if", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.copy
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 ...
pandas/core/generic.py
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): """ 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...
[ "Make", "a", "copy", "of", "this", "object", "s", "indices", "and", "data", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5733-L5839
[ "def", "copy", "(", "self", ",", "deep", "=", "True", ")", ":", "data", "=", "self", ".", "_data", ".", "copy", "(", "deep", "=", "deep", ")", "return", "self", ".", "_constructor", "(", "data", ")", ".", "__finalize__", "(", "self", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._convert
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...
pandas/core/generic.py
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): """ Attempt to infer better dtype for object columns Parameters ---------- datetime : boolean, default False If True, convert to date where possible. ...
[ "Attempt", "to", "infer", "better", "dtype", "for", "object", "columns" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5855-L5884
[ "def", "_convert", "(", "self", ",", "datetime", "=", "False", ",", "numeric", "=", "False", ",", "timedelta", "=", "False", ",", "coerce", "=", "False", ",", "copy", "=", "True", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "_d...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.convert_objects
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...
pandas/core/generic.py
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): """ Attempt to infer better dtype for object columns. .. deprecated:: 0.21.0 Parameters ---------- convert_dates : boolean, default True ...
[ "Attempt", "to", "infer", "better", "dtype", "for", "object", "columns", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5886-L5930
[ "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...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.infer_objects
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...
pandas/core/generic.py
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): """ 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. ...
[ "Attempt", "to", "infer", "better", "dtypes", "for", "object", "columns", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5932-L5977
[ "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", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.fillna
Fill NA/NaN values using the specified method. Parameters ---------- value : scalar, dict, Series, or DataFrame Value to use to fill holes (e.g. 0), alternately a dict/Series/DataFrame of values specifying which value to use for each index (for a Series) or c...
pandas/core/generic.py
def fillna(self, value=None, method=None, axis=None, inplace=False, limit=None, downcast=None): """ Fill NA/NaN values using the specified method. Parameters ---------- value : scalar, dict, Series, or DataFrame Value to use to fill holes (e.g. 0), alt...
def fillna(self, value=None, method=None, axis=None, inplace=False, limit=None, downcast=None): """ Fill NA/NaN values using the specified method. Parameters ---------- value : scalar, dict, Series, or DataFrame Value to use to fill holes (e.g. 0), alt...
[ "Fill", "NA", "/", "NaN", "values", "using", "the", "specified", "method", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L5982-L6169
[ "def", "fillna", "(", "self", ",", "value", "=", "None", ",", "method", "=", "None", ",", "axis", "=", "None", ",", "inplace", "=", "False", ",", "limit", "=", "None", ",", "downcast", "=", "None", ")", ":", "inplace", "=", "validate_bool_kwarg", "("...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.interpolate
Interpolate values according to different methods.
pandas/core/generic.py
def interpolate(self, method='linear', axis=0, limit=None, inplace=False, limit_direction='forward', limit_area=None, downcast=None, **kwargs): """ Interpolate values according to different methods. """ inplace = validate_bool_kwarg(inplace, 'inpla...
def interpolate(self, method='linear', axis=0, limit=None, inplace=False, limit_direction='forward', limit_area=None, downcast=None, **kwargs): """ Interpolate values according to different methods. """ inplace = validate_bool_kwarg(inplace, 'inpla...
[ "Interpolate", "values", "according", "to", "different", "methods", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L6817-L6894
[ "def", "interpolate", "(", "self", ",", "method", "=", "'linear'", ",", "axis", "=", "0", ",", "limit", "=", "None", ",", "inplace", "=", "False", ",", "limit_direction", "=", "'forward'", ",", "limit_area", "=", "None", ",", "downcast", "=", "None", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.asof
Return the last row(s) without any NaNs before `where`. The last row (for each element in `where`, if list) without any NaN is taken. In case of a :class:`~pandas.DataFrame`, the last row without NaN considering only the subset of columns (if not `None`) .. versionadded:: 0.19....
pandas/core/generic.py
def asof(self, where, subset=None): """ Return the last row(s) without any NaNs before `where`. The last row (for each element in `where`, if list) without any NaN is taken. In case of a :class:`~pandas.DataFrame`, the last row without NaN considering only the subset of ...
def asof(self, where, subset=None): """ Return the last row(s) without any NaNs before `where`. The last row (for each element in `where`, if list) without any NaN is taken. In case of a :class:`~pandas.DataFrame`, the last row without NaN considering only the subset of ...
[ "Return", "the", "last", "row", "(", "s", ")", "without", "any", "NaNs", "before", "where", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L6899-L7067
[ "def", "asof", "(", "self", ",", "where", ",", "subset", "=", "None", ")", ":", "if", "isinstance", "(", "where", ",", "str", ")", ":", "from", "pandas", "import", "to_datetime", "where", "=", "to_datetime", "(", "where", ")", "if", "not", "self", "....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.clip
Trim values at input threshold(s). Assigns values outside boundary to boundary values. Thresholds can be singular values or array like, and in the latter case the clipping is performed element-wise in the specified axis. Parameters ---------- lower : float or array_like...
pandas/core/generic.py
def clip(self, lower=None, upper=None, axis=None, inplace=False, *args, **kwargs): """ Trim values at input threshold(s). Assigns values outside boundary to boundary values. Thresholds can be singular values or array like, and in the latter case the clipping is perf...
def clip(self, lower=None, upper=None, axis=None, inplace=False, *args, **kwargs): """ Trim values at input threshold(s). Assigns values outside boundary to boundary values. Thresholds can be singular values or array like, and in the latter case the clipping is perf...
[ "Trim", "values", "at", "input", "threshold", "(", "s", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7256-L7369
[ "def", "clip", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ",", "axis", "=", "None", ",", "inplace", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "self", ",", "ABCPanel", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.clip_upper
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...
pandas/core/generic.py
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): """ 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 ...
[ "Trim", "values", "above", "a", "given", "threshold", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7371-L7449
[ "def", "clip_upper", "(", "self", ",", "threshold", ",", "axis", "=", "None", ",", "inplace", "=", "False", ")", ":", "warnings", ".", "warn", "(", "'clip_upper(threshold) is deprecated, '", "'use clip(upper=threshold) instead'", ",", "FutureWarning", ",", "stacklev...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.clip_lower
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...
pandas/core/generic.py
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): """ 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 ...
[ "Trim", "values", "below", "a", "given", "threshold", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7451-L7565
[ "def", "clip_lower", "(", "self", ",", "threshold", ",", "axis", "=", "None", ",", "inplace", "=", "False", ")", ":", "warnings", ".", "warn", "(", "'clip_lower(threshold) is deprecated, '", "'use clip(lower=threshold) instead'", ",", "FutureWarning", ",", "stacklev...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.groupby
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...
pandas/core/generic.py
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=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...
[ "Group", "DataFrame", "or", "Series", "using", "a", "mapper", "or", "by", "a", "Series", "of", "columns", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7567-L7685
[ "def", "groupby", "(", "self", ",", "by", "=", "None", ",", "axis", "=", "0", ",", "level", "=", "None", ",", "as_index", "=", "True", ",", "sort", "=", "True", ",", "group_keys", "=", "True", ",", "squeeze", "=", "False", ",", "observed", "=", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.asfreq
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...
pandas/core/generic.py
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): """ 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 ...
[ "Convert", "TimeSeries", "to", "specified", "frequency", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7687-L7784
[ "def", "asfreq", "(", "self", ",", "freq", ",", "method", "=", "None", ",", "how", "=", "None", ",", "normalize", "=", "False", ",", "fill_value", "=", "None", ")", ":", "from", "pandas", ".", "core", ".", "resample", "import", "asfreq", "return", "a...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.at_time
Select values at particular time of day (e.g. 9:30AM). Parameters ---------- time : datetime.time or str axis : {0 or 'index', 1 or 'columns'}, default 0 .. versionadded:: 0.24.0 Returns ------- Series or DataFrame Raises ------ ...
pandas/core/generic.py
def at_time(self, time, asof=False, axis=None): """ Select values at particular time of day (e.g. 9:30AM). Parameters ---------- time : datetime.time or str axis : {0 or 'index', 1 or 'columns'}, default 0 .. versionadded:: 0.24.0 Returns --...
def at_time(self, time, asof=False, axis=None): """ Select values at particular time of day (e.g. 9:30AM). Parameters ---------- time : datetime.time or str axis : {0 or 'index', 1 or 'columns'}, default 0 .. versionadded:: 0.24.0 Returns --...
[ "Select", "values", "at", "particular", "time", "of", "day", "(", "e", ".", "g", ".", "9", ":", "30AM", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7786-L7840
[ "def", "at_time", "(", "self", ",", "time", ",", "asof", "=", "False", ",", "axis", "=", "None", ")", ":", "if", "axis", "is", "None", ":", "axis", "=", "self", ".", "_stat_axis_number", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.between_time
Select values between particular times of the day (e.g., 9:00-9:30 AM). By setting ``start_time`` to be later than ``end_time``, you can get the times that are *not* between the two times. Parameters ---------- start_time : datetime.time or str end_time : datetime.time ...
pandas/core/generic.py
def between_time(self, start_time, end_time, include_start=True, include_end=True, axis=None): """ Select values between particular times of the day (e.g., 9:00-9:30 AM). By setting ``start_time`` to be later than ``end_time``, you can get the times that are *not* b...
def between_time(self, start_time, end_time, include_start=True, include_end=True, axis=None): """ Select values between particular times of the day (e.g., 9:00-9:30 AM). By setting ``start_time`` to be later than ``end_time``, you can get the times that are *not* b...
[ "Select", "values", "between", "particular", "times", "of", "the", "day", "(", "e", ".", "g", ".", "9", ":", "00", "-", "9", ":", "30", "AM", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7842-L7913
[ "def", "between_time", "(", "self", ",", "start_time", ",", "end_time", ",", "include_start", "=", "True", ",", "include_end", "=", "True", ",", "axis", "=", "None", ")", ":", "if", "axis", "is", "None", ":", "axis", "=", "self", ".", "_stat_axis_number"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.resample
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 --...
pandas/core/generic.py
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, loffset=None, limit=None, base=0, on=None, level=None): """ Resample time-series data. Convenience method for frequency conversion and resamplin...
[ "Resample", "time", "-", "series", "data", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L7915-L8212
[ "def", "resample", "(", "self", ",", "rule", ",", "how", "=", "None", ",", "axis", "=", "0", ",", "fill_method", "=", "None", ",", "closed", "=", "None", ",", "label", "=", "None", ",", "convention", "=", "'start'", ",", "kind", "=", "None", ",", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.first
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 ...
pandas/core/generic.py
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): """ 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 ...
[ "Convenience", "method", "for", "subsetting", "initial", "periods", "of", "time", "series", "data", "based", "on", "a", "date", "offset", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8214-L8275
[ "def", "first", "(", "self", ",", "offset", ")", ":", "if", "not", "isinstance", "(", "self", ".", "index", ",", "DatetimeIndex", ")", ":", "raise", "TypeError", "(", "\"'first' only supports a DatetimeIndex index\"", ")", "if", "len", "(", "self", ".", "ind...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.last
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 ...
pandas/core/generic.py
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): """ 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 ...
[ "Convenience", "method", "for", "subsetting", "final", "periods", "of", "time", "series", "data", "based", "on", "a", "date", "offset", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8277-L8333
[ "def", "last", "(", "self", ",", "offset", ")", ":", "if", "not", "isinstance", "(", "self", ".", "index", ",", "DatetimeIndex", ")", ":", "raise", "TypeError", "(", "\"'last' only supports a DatetimeIndex index\"", ")", "if", "len", "(", "self", ".", "index...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.rank
Compute numerical data ranks (1 through n) along axis. Equal values are assigned a rank that is the average of the ranks of those values. Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 index to direct ranking method : {'average', 'min', 'max',...
pandas/core/generic.py
def rank(self, axis=0, method='average', numeric_only=None, na_option='keep', ascending=True, pct=False): """ Compute numerical data ranks (1 through n) along axis. Equal values are assigned a rank that is the average of the ranks of those values. Parameters -------...
def rank(self, axis=0, method='average', numeric_only=None, na_option='keep', ascending=True, pct=False): """ Compute numerical data ranks (1 through n) along axis. Equal values are assigned a rank that is the average of the ranks of those values. Parameters -------...
[ "Compute", "numerical", "data", "ranks", "(", "1", "through", "n", ")", "along", "axis", ".", "Equal", "values", "are", "assigned", "a", "rank", "that", "is", "the", "average", "of", "the", "ranks", "of", "those", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8335-L8397
[ "def", "rank", "(", "self", ",", "axis", "=", "0", ",", "method", "=", "'average'", ",", "numeric_only", "=", "None", ",", "na_option", "=", "'keep'", ",", "ascending", "=", "True", ",", "pct", "=", "False", ")", ":", "axis", "=", "self", ".", "_ge...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._where
Equivalent to public method `where`, except that `other` is not applied as a function even if callable. Used in __setitem__.
pandas/core/generic.py
def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None, errors='raise', try_cast=False): """ Equivalent to public method `where`, except that `other` is not applied as a function even if callable. Used in __setitem__. """ inplace = validate_bool_...
def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None, errors='raise', try_cast=False): """ Equivalent to public method `where`, except that `other` is not applied as a function even if callable. Used in __setitem__. """ inplace = validate_bool_...
[ "Equivalent", "to", "public", "method", "where", "except", "that", "other", "is", "not", "applied", "as", "a", "function", "even", "if", "callable", ".", "Used", "in", "__setitem__", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L8609-L8743
[ "def", "_where", "(", "self", ",", "cond", ",", "other", "=", "np", ".", "nan", ",", "inplace", "=", "False", ",", "axis", "=", "None", ",", "level", "=", "None", ",", "errors", "=", "'raise'", ",", "try_cast", "=", "False", ")", ":", "inplace", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.slice_shift
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 ...
pandas/core/generic.py
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): """ 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...
[ "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", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9010-L9044
[ "def", "slice_shift", "(", "self", ",", "periods", "=", "1", ",", "axis", "=", "0", ")", ":", "if", "periods", "==", "0", ":", "return", "self", "if", "periods", ">", "0", ":", "vslicer", "=", "slice", "(", "None", ",", "-", "periods", ")", "isli...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.tshift
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 ...
pandas/core/generic.py
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): """ 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...
[ "Shift", "the", "time", "index", "using", "the", "index", "s", "frequency", "if", "available", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9046-L9101
[ "def", "tshift", "(", "self", ",", "periods", "=", "1", ",", "freq", "=", "None", ",", "axis", "=", "0", ")", ":", "index", "=", "self", ".", "_get_axis", "(", "axis", ")", "if", "freq", "is", "None", ":", "freq", "=", "getattr", "(", "index", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.truncate
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. ...
pandas/core/generic.py
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): """ 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 ---------- ...
[ "Truncate", "a", "Series", "or", "DataFrame", "before", "and", "after", "some", "index", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9103-L9255
[ "def", "truncate", "(", "self", ",", "before", "=", "None", ",", "after", "=", "None", ",", "axis", "=", "None", ",", "copy", "=", "True", ")", ":", "if", "axis", "is", "None", ":", "axis", "=", "self", ".", "_stat_axis_number", "axis", "=", "self"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.tz_convert
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...
pandas/core/generic.py
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): """ 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...
[ "Convert", "tz", "-", "aware", "axis", "to", "target", "time", "zone", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9257-L9307
[ "def", "tz_convert", "(", "self", ",", "tz", ",", "axis", "=", "0", ",", "level", "=", "None", ",", "copy", "=", "True", ")", ":", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "ax", "=", "self", ".", "_get_axis", "(", "axis", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.tz_localize
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...
pandas/core/generic.py
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'): """ 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...
[ "Localize", "tz", "-", "naive", "index", "of", "a", "Series", "or", "DataFrame", "to", "target", "time", "zone", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9309-L9471
[ "def", "tz_localize", "(", "self", ",", "tz", ",", "axis", "=", "0", ",", "level", "=", "None", ",", "copy", "=", "True", ",", "ambiguous", "=", "'raise'", ",", "nonexistent", "=", "'raise'", ")", ":", "nonexistent_options", "=", "(", "'raise'", ",", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame.describe
Generate descriptive statistics that summarize the central tendency, dispersion and shape of a dataset's distribution, excluding ``NaN`` values. Analyzes both numeric and object series, as well as ``DataFrame`` column sets of mixed data types. The output will vary depending on w...
pandas/core/generic.py
def describe(self, percentiles=None, include=None, exclude=None): """ Generate descriptive statistics that summarize the central tendency, dispersion and shape of a dataset's distribution, excluding ``NaN`` values. Analyzes both numeric and object series, as well as ``Da...
def describe(self, percentiles=None, include=None, exclude=None): """ Generate descriptive statistics that summarize the central tendency, dispersion and shape of a dataset's distribution, excluding ``NaN`` values. Analyzes both numeric and object series, as well as ``Da...
[ "Generate", "descriptive", "statistics", "that", "summarize", "the", "central", "tendency", "dispersion", "and", "shape", "of", "a", "dataset", "s", "distribution", "excluding", "NaN", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9544-L9875
[ "def", "describe", "(", "self", ",", "percentiles", "=", "None", ",", "include", "=", "None", ",", "exclude", "=", "None", ")", ":", "if", "self", ".", "ndim", ">=", "3", ":", "msg", "=", "\"describe is not implemented on Panel objects.\"", "raise", "NotImpl...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._check_percentile
Validate percentiles (used by describe and quantile).
pandas/core/generic.py
def _check_percentile(self, q): """ Validate percentiles (used by describe and quantile). """ msg = ("percentiles should all be in the interval [0, 1]. " "Try {0} instead.") q = np.asarray(q) if q.ndim == 0: if not 0 <= q <= 1: ...
def _check_percentile(self, q): """ Validate percentiles (used by describe and quantile). """ msg = ("percentiles should all be in the interval [0, 1]. " "Try {0} instead.") q = np.asarray(q) if q.ndim == 0: if not 0 <= q <= 1: ...
[ "Validate", "percentiles", "(", "used", "by", "describe", "and", "quantile", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L9877-L9891
[ "def", "_check_percentile", "(", "self", ",", "q", ")", ":", "msg", "=", "(", "\"percentiles should all be in the interval [0, 1]. \"", "\"Try {0} instead.\"", ")", "q", "=", "np", ".", "asarray", "(", "q", ")", "if", "q", ".", "ndim", "==", "0", ":", "if", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._add_numeric_operations
Add the operations to the cls; evaluate the doc strings again
pandas/core/generic.py
def _add_numeric_operations(cls): """ Add the operations to the cls; evaluate the doc strings again """ axis_descr, name, name2 = _doc_parms(cls) cls.any = _make_logical_function( cls, 'any', name, name2, axis_descr, _any_desc, nanops.nanany, _any_see_al...
def _add_numeric_operations(cls): """ Add the operations to the cls; evaluate the doc strings again """ axis_descr, name, name2 = _doc_parms(cls) cls.any = _make_logical_function( cls, 'any', name, name2, axis_descr, _any_desc, nanops.nanany, _any_see_al...
[ "Add", "the", "operations", "to", "the", "cls", ";", "evaluate", "the", "doc", "strings", "again" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10038-L10162
[ "def", "_add_numeric_operations", "(", "cls", ")", ":", "axis_descr", ",", "name", ",", "name2", "=", "_doc_parms", "(", "cls", ")", "cls", ".", "any", "=", "_make_logical_function", "(", "cls", ",", "'any'", ",", "name", ",", "name2", ",", "axis_descr", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._add_series_only_operations
Add the series only operations to the cls; evaluate the doc strings again.
pandas/core/generic.py
def _add_series_only_operations(cls): """ Add the series only operations to the cls; evaluate the doc strings again. """ axis_descr, name, name2 = _doc_parms(cls) def nanptp(values, axis=0, skipna=True): nmax = nanops.nanmax(values, axis, skipna) ...
def _add_series_only_operations(cls): """ Add the series only operations to the cls; evaluate the doc strings again. """ axis_descr, name, name2 = _doc_parms(cls) def nanptp(values, axis=0, skipna=True): nmax = nanops.nanmax(values, axis, skipna) ...
[ "Add", "the", "series", "only", "operations", "to", "the", "cls", ";", "evaluate", "the", "doc", "strings", "again", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10165-L10187
[ "def", "_add_series_only_operations", "(", "cls", ")", ":", "axis_descr", ",", "name", ",", "name2", "=", "_doc_parms", "(", "cls", ")", "def", "nanptp", "(", "values", ",", "axis", "=", "0", ",", "skipna", "=", "True", ")", ":", "nmax", "=", "nanops",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._add_series_or_dataframe_operations
Add the series or dataframe only operations to the cls; evaluate the doc strings again.
pandas/core/generic.py
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): """ 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,...
[ "Add", "the", "series", "or", "dataframe", "only", "operations", "to", "the", "cls", ";", "evaluate", "the", "doc", "strings", "again", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10190-L10226
[ "def", "_add_series_or_dataframe_operations", "(", "cls", ")", ":", "from", "pandas", ".", "core", "import", "window", "as", "rwindow", "@", "Appender", "(", "rwindow", ".", "rolling", ".", "__doc__", ")", "def", "rolling", "(", "self", ",", "window", ",", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrame._find_valid_index
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
pandas/core/generic.py
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): """ 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...
[ "Retrieves", "the", "index", "of", "the", "first", "valid", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10253-L10286
[ "def", "_find_valid_index", "(", "self", ",", "how", ")", ":", "assert", "how", "in", "[", "'first'", ",", "'last'", "]", "if", "len", "(", "self", ")", "==", "0", ":", "# early stop", "return", "None", "is_valid", "=", "~", "self", ".", "isna", "(",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PandasObject._reset_cache
Reset cached properties. If ``key`` is passed, only clears that key.
pandas/core/base.py
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): """ 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)
[ "Reset", "cached", "properties", ".", "If", "key", "is", "passed", "only", "clears", "that", "key", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L86-L95
[ "def", "_reset_cache", "(", "self", ",", "key", "=", "None", ")", ":", "if", "getattr", "(", "self", ",", "'_cache'", ",", "None", ")", "is", "None", ":", "return", "if", "key", "is", "None", ":", "self", ".", "_cache", ".", "clear", "(", ")", "e...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SelectionMixin._try_aggregate_string_function
if arg is a string, then try to operate on it: - try to find a function (or attribute) on ourselves - try to find a numpy function - raise
pandas/core/base.py
def _try_aggregate_string_function(self, arg, *args, **kwargs): """ if arg is a string, then try to operate on it: - try to find a function (or attribute) on ourselves - try to find a numpy function - raise """ assert isinstance(arg, str) f = getattr(sel...
def _try_aggregate_string_function(self, arg, *args, **kwargs): """ if arg is a string, then try to operate on it: - try to find a function (or attribute) on ourselves - try to find a numpy function - raise """ assert isinstance(arg, str) f = getattr(sel...
[ "if", "arg", "is", "a", "string", "then", "try", "to", "operate", "on", "it", ":", "-", "try", "to", "find", "a", "function", "(", "or", "attribute", ")", "on", "ourselves", "-", "try", "to", "find", "a", "numpy", "function", "-", "raise" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L285-L311
[ "def", "_try_aggregate_string_function", "(", "self", ",", "arg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "arg", ",", "str", ")", "f", "=", "getattr", "(", "self", ",", "arg", ",", "None", ")", "if", "f", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SelectionMixin._aggregate
provide an implementation for the aggregators Parameters ---------- arg : string, dict, function *args : args to pass on to the function **kwargs : kwargs to pass on to the function Returns ------- tuple of result, how Notes ----- ...
pandas/core/base.py
def _aggregate(self, arg, *args, **kwargs): """ provide an implementation for the aggregators Parameters ---------- arg : string, dict, function *args : args to pass on to the function **kwargs : kwargs to pass on to the function Returns ------- ...
def _aggregate(self, arg, *args, **kwargs): """ provide an implementation for the aggregators Parameters ---------- arg : string, dict, function *args : args to pass on to the function **kwargs : kwargs to pass on to the function Returns ------- ...
[ "provide", "an", "implementation", "for", "the", "aggregators" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L313-L553
[ "def", "_aggregate", "(", "self", ",", "arg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "is_aggregator", "=", "lambda", "x", ":", "isinstance", "(", "x", ",", "(", "list", ",", "tuple", ",", "dict", ")", ")", "is_nested_renamer", "=", "F...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SelectionMixin._shallow_copy
return a new object with the replacement attributes
pandas/core/base.py
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): """ 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): ...
[ "return", "a", "new", "object", "with", "the", "replacement", "attributes" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L619-L632
[ "def", "_shallow_copy", "(", "self", ",", "obj", "=", "None", ",", "obj_type", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "obj", "is", "None", ":", "obj", "=", "self", ".", "_selected_obj", ".", "copy", "(", ")", "if", "obj_type", "is", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.itemsize
Return the size of the dtype of the item of the underlying data. .. deprecated:: 0.23.0
pandas/core/base.py
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): """ 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__), ...
[ "Return", "the", "size", "of", "the", "dtype", "of", "the", "item", "of", "the", "underlying", "data", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L715-L724
[ "def", "itemsize", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"{obj}.itemsize is deprecated and will be removed \"", "\"in a future version\"", ".", "format", "(", "obj", "=", "type", "(", "self", ")", ".", "__name__", ")", ",", "FutureWarning", ",", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.base
Return the base object if the memory of the underlying data is shared. .. deprecated:: 0.23.0
pandas/core/base.py
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): """ 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__), ...
[ "Return", "the", "base", "object", "if", "the", "memory", "of", "the", "underlying", "data", "is", "shared", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L765-L774
[ "def", "base", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"{obj}.base is deprecated and will be removed \"", "\"in a future version\"", ".", "format", "(", "obj", "=", "type", "(", "self", ")", ".", "__name__", ")", ",", "FutureWarning", ",", "stackl...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.array
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 ...
pandas/core/base.py
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: """ 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...
[ "The", "ExtensionArray", "of", "the", "data", "backing", "this", "Series", "or", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L777-L853
[ "def", "array", "(", "self", ")", "->", "ExtensionArray", ":", "result", "=", "self", ".", "_values", "if", "is_datetime64_ns_dtype", "(", "result", ".", "dtype", ")", ":", "from", "pandas", ".", "arrays", "import", "DatetimeArray", "result", "=", "DatetimeA...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.to_numpy
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...
pandas/core/base.py
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): """ 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...
[ "A", "NumPy", "ndarray", "representing", "the", "values", "in", "this", "Series", "or", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L855-L949
[ "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...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin._ndarray_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
pandas/core/base.py
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: """ 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...
[ "The", "data", "as", "an", "ndarray", "possibly", "losing", "information", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L952-L963
[ "def", "_ndarray_values", "(", "self", ")", "->", "np", ".", "ndarray", ":", "if", "is_extension_array_dtype", "(", "self", ")", ":", "return", "self", ".", "array", ".", "_ndarray_values", "return", "self", ".", "values" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.max
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 ------...
pandas/core/base.py
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): """ 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 ...
[ "Return", "the", "maximum", "value", "of", "the", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L969-L1007
[ "def", "max", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ")", ":", "nv", ".", "validate_minmax_axis", "(", "axis", ")", "return", "nanops", ".", "nanmax", "(", "self", ".", "_values", ",", "skipna", "=", "skipna", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.argmax
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
pandas/core/base.py
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): """ 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...
[ "Return", "an", "ndarray", "of", "the", "maximum", "argument", "indexer", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1009-L1024
[ "def", "argmax", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ")", ":", "nv", ".", "validate_minmax_axis", "(", "axis", ")", "return", "nanops", ".", "nanargmax", "(", "self", ".", "_values", ",", "skipna", "=", "skipna", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.min
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 :...
pandas/core/base.py
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): """ Return the minimum value of the Index. Parameters ---------- axis : {None} Dummy argument for consistency with Series skipna : bool, default True Returns ------- scalar Minimum va...
[ "Return", "the", "minimum", "value", "of", "the", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1026-L1064
[ "def", "min", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ")", ":", "nv", ".", "validate_minmax_axis", "(", "axis", ")", "return", "nanops", ".", "nanmin", "(", "self", ".", "_values", ",", "skipna", "=", "skipna", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.argmin
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
pandas/core/base.py
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): """ Return a ndarray of the minimum argument indexer. Parameters ---------- axis : {None} Dummy argument for consistency with Series skipna : bool, default True Returns ------- numpy.ndarray ...
[ "Return", "a", "ndarray", "of", "the", "minimum", "argument", "indexer", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1066-L1085
[ "def", "argmin", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ")", ":", "nv", ".", "validate_minmax_axis", "(", "axis", ")", "return", "nanops", ".", "nanargmin", "(", "self", ".", "_values", ",", "skipna", "=", "skipna", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.tolist
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
pandas/core/base.py
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): """ 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...
[ "Return", "a", "list", "of", "the", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1087-L1108
[ "def", "tolist", "(", "self", ")", ":", "if", "is_datetimelike", "(", "self", ".", "_values", ")", ":", "return", "[", "com", ".", "maybe_box_datetimelike", "(", "x", ")", "for", "x", "in", "self", ".", "_values", "]", "elif", "is_extension_array_dtype", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin._reduce
perform the reduction type operation if we can
pandas/core/base.py
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): """ 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( ...
[ "perform", "the", "reduction", "type", "operation", "if", "we", "can" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1135-L1142
[ "def", "_reduce", "(", "self", ",", "op", ",", "name", ",", "axis", "=", "0", ",", "skipna", "=", "True", ",", "numeric_only", "=", "None", ",", "filter_type", "=", "None", ",", "*", "*", "kwds", ")", ":", "func", "=", "getattr", "(", "self", ","...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin._map_values
An internal function that maps values using the input correspondence (which can be a dict, Series, or function). Parameters ---------- mapper : function, dict, or Series The input correspondence object na_action : {None, 'ignore'} If 'ignore', propagate N...
pandas/core/base.py
def _map_values(self, mapper, na_action=None): """ An internal function that maps values using the input correspondence (which can be a dict, Series, or function). Parameters ---------- mapper : function, dict, or Series The input correspondence object ...
def _map_values(self, mapper, na_action=None): """ An internal function that maps values using the input correspondence (which can be a dict, Series, or function). Parameters ---------- mapper : function, dict, or Series The input correspondence object ...
[ "An", "internal", "function", "that", "maps", "values", "using", "the", "input", "correspondence", "(", "which", "can", "be", "a", "dict", "Series", "or", "function", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1144-L1215
[ "def", "_map_values", "(", "self", ",", "mapper", ",", "na_action", "=", "None", ")", ":", "# we can fastpath dict/Series to an efficient map", "# as we know that we are not going to have to yield", "# python types", "if", "isinstance", "(", "mapper", ",", "dict", ")", ":...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.value_counts
Return a Series containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occurring element. Excludes NA values by default. Parameters ---------- normalize : boolean, default False I...
pandas/core/base.py
def value_counts(self, normalize=False, sort=True, ascending=False, bins=None, dropna=True): """ Return a Series containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occurring element. ...
def value_counts(self, normalize=False, sort=True, ascending=False, bins=None, dropna=True): """ Return a Series containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occurring element. ...
[ "Return", "a", "Series", "containing", "counts", "of", "unique", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1217-L1299
[ "def", "value_counts", "(", "self", ",", "normalize", "=", "False", ",", "sort", "=", "True", ",", "ascending", "=", "False", ",", "bins", "=", "None", ",", "dropna", "=", "True", ")", ":", "from", "pandas", ".", "core", ".", "algorithms", "import", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.nunique
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...
pandas/core/base.py
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): """ 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...
[ "Return", "number", "of", "unique", "elements", "in", "the", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1313-L1351
[ "def", "nunique", "(", "self", ",", "dropna", "=", "True", ")", ":", "uniqs", "=", "self", ".", "unique", "(", ")", "n", "=", "len", "(", "uniqs", ")", "if", "dropna", "and", "isna", "(", "uniqs", ")", ".", "any", "(", ")", ":", "n", "-=", "1...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
IndexOpsMixin.memory_usage
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 ...
pandas/core/base.py
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): """ Memory usage of the values Parameters ---------- deep : bool Introspect the data deeply, interrogate `object` dtypes for system-level memory consumption Returns ------- bytes used S...
[ "Memory", "usage", "of", "the", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/base.py#L1396-L1425
[ "def", "memory_usage", "(", "self", ",", "deep", "=", "False", ")", ":", "if", "hasattr", "(", "self", ".", "array", ",", "'memory_usage'", ")", ":", "return", "self", ".", "array", ".", "memory_usage", "(", "deep", "=", "deep", ")", "v", "=", "self"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_expand_user
Return the argument with an initial component of ~ or ~user replaced by that user's home directory. Parameters ---------- filepath_or_buffer : object to be converted if possible Returns ------- expanded_filepath_or_buffer : an expanded filepath or the i...
pandas/io/common.py
def _expand_user(filepath_or_buffer): """Return the argument with an initial component of ~ or ~user replaced by that user's home directory. Parameters ---------- filepath_or_buffer : object to be converted if possible Returns ------- expanded_filepath_or_buffer : an expanded filepa...
def _expand_user(filepath_or_buffer): """Return the argument with an initial component of ~ or ~user replaced by that user's home directory. Parameters ---------- filepath_or_buffer : object to be converted if possible Returns ------- expanded_filepath_or_buffer : an expanded filepa...
[ "Return", "the", "argument", "with", "an", "initial", "component", "of", "~", "or", "~user", "replaced", "by", "that", "user", "s", "home", "directory", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L70-L85
[ "def", "_expand_user", "(", "filepath_or_buffer", ")", ":", "if", "isinstance", "(", "filepath_or_buffer", ",", "str", ")", ":", "return", "os", ".", "path", ".", "expanduser", "(", "filepath_or_buffer", ")", "return", "filepath_or_buffer" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_stringify_path
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...
pandas/io/common.py
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): """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...
[ "Attempt", "to", "convert", "a", "path", "-", "like", "object", "to", "a", "string", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L96-L136
[ "def", "_stringify_path", "(", "filepath_or_buffer", ")", ":", "try", ":", "import", "pathlib", "_PATHLIB_INSTALLED", "=", "True", "except", "ImportError", ":", "_PATHLIB_INSTALLED", "=", "False", "try", ":", "from", "py", ".", "path", "import", "local", "as", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
get_filepath_or_buffer
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 :...
pandas/io/common.py
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): """ 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...
[ "If", "the", "filepath_or_buffer", "is", "a", "url", "translate", "and", "return", "the", "buffer", ".", "Otherwise", "passthrough", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L155-L209
[ "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...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_infer_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. Parameters ---------- filepath_or_buffer : a path...
pandas/io/common.py
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): """ 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. ...
[ "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...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L235-L286
[ "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...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_handle
Get file handle for given path/buffer and mode. Parameters ---------- path_or_buf : a path (str) or buffer mode : str mode to open path_or_buf with encoding : str or None compression : {'infer', 'gzip', 'bz2', 'zip', 'xz', None}, default None If 'infer' and `filepath_or_...
pandas/io/common.py
def _get_handle(path_or_buf, mode, encoding=None, compression=None, memory_map=False, is_text=True): """ Get file handle for given path/buffer and mode. Parameters ---------- path_or_buf : a path (str) or buffer mode : str mode to open path_or_buf with encodi...
def _get_handle(path_or_buf, mode, encoding=None, compression=None, memory_map=False, is_text=True): """ Get file handle for given path/buffer and mode. Parameters ---------- path_or_buf : a path (str) or buffer mode : str mode to open path_or_buf with encodi...
[ "Get", "file", "handle", "for", "given", "path", "/", "buffer", "and", "mode", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/common.py#L289-L410
[ "def", "_get_handle", "(", "path_or_buf", ",", "mode", ",", "encoding", "=", "None", ",", "compression", "=", "None", ",", "memory_map", "=", "False", ",", "is_text", "=", "True", ")", ":", "try", ":", "from", "s3fs", "import", "S3File", "need_text_wrappin...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_td_array_cmp
Wrap comparison operations to convert timedelta-like to timedelta64
pandas/core/arrays/timedeltas.py
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): """ 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...
[ "Wrap", "comparison", "operations", "to", "convert", "timedelta", "-", "like", "to", "timedelta64" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L56-L102
[ "def", "_td_array_cmp", "(", "cls", ",", "op", ")", ":", "opname", "=", "'__{name}__'", ".", "format", "(", "name", "=", "op", ".", "__name__", ")", "nat_result", "=", "opname", "==", "'__ne__'", "def", "wrapper", "(", "self", ",", "other", ")", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
sequence_to_td64ns
Parameters ---------- array : list-like copy : bool, default False unit : str, default "ns" The timedelta unit to treat integers as multiples of. errors : {"raise", "coerce", "ignore"}, default "raise" How to handle elements that cannot be converted to timedelta64[ns]. See ``...
pandas/core/arrays/timedeltas.py
def sequence_to_td64ns(data, copy=False, unit="ns", errors="raise"): """ Parameters ---------- array : list-like copy : bool, default False unit : str, default "ns" The timedelta unit to treat integers as multiples of. errors : {"raise", "coerce", "ignore"}, default "raise" H...
def sequence_to_td64ns(data, copy=False, unit="ns", errors="raise"): """ Parameters ---------- array : list-like copy : bool, default False unit : str, default "ns" The timedelta unit to treat integers as multiples of. errors : {"raise", "coerce", "ignore"}, default "raise" H...
[ "Parameters", "----------", "array", ":", "list", "-", "like", "copy", ":", "bool", "default", "False", "unit", ":", "str", "default", "ns", "The", "timedelta", "unit", "to", "treat", "integers", "as", "multiples", "of", ".", "errors", ":", "{", "raise", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L854-L947
[ "def", "sequence_to_td64ns", "(", "data", ",", "copy", "=", "False", ",", "unit", "=", "\"ns\"", ",", "errors", "=", "\"raise\"", ")", ":", "inferred_freq", "=", "None", "unit", "=", "parse_timedelta_unit", "(", "unit", ")", "# Unwrap whatever we have into a np....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ints_to_td64ns
Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating the integers as multiples of the given timedelta unit. Parameters ---------- data : numpy.ndarray with integer-dtype unit : str, default "ns" The timedelta unit to treat integers as multiples of. Returns -----...
pandas/core/arrays/timedeltas.py
def ints_to_td64ns(data, unit="ns"): """ Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating the integers as multiples of the given timedelta unit. Parameters ---------- data : numpy.ndarray with integer-dtype unit : str, default "ns" The timedelta unit to treat...
def ints_to_td64ns(data, unit="ns"): """ Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating the integers as multiples of the given timedelta unit. Parameters ---------- data : numpy.ndarray with integer-dtype unit : str, default "ns" The timedelta unit to treat...
[ "Convert", "an", "ndarray", "with", "integer", "-", "dtype", "to", "timedelta64", "[", "ns", "]", "dtype", "treating", "the", "integers", "as", "multiples", "of", "the", "given", "timedelta", "unit", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L950-L987
[ "def", "ints_to_td64ns", "(", "data", ",", "unit", "=", "\"ns\"", ")", ":", "copy_made", "=", "False", "unit", "=", "unit", "if", "unit", "is", "not", "None", "else", "\"ns\"", "if", "data", ".", "dtype", "!=", "np", ".", "int64", ":", "# converting to...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
objects_to_td64ns
Convert a object-dtyped or string-dtyped array into an timedelta64[ns]-dtyped array. Parameters ---------- data : ndarray or Index unit : str, default "ns" The timedelta unit to treat integers as multiples of. errors : {"raise", "coerce", "ignore"}, default "raise" How to handle...
pandas/core/arrays/timedeltas.py
def objects_to_td64ns(data, unit="ns", errors="raise"): """ Convert a object-dtyped or string-dtyped array into an timedelta64[ns]-dtyped array. Parameters ---------- data : ndarray or Index unit : str, default "ns" The timedelta unit to treat integers as multiples of. errors : ...
def objects_to_td64ns(data, unit="ns", errors="raise"): """ Convert a object-dtyped or string-dtyped array into an timedelta64[ns]-dtyped array. Parameters ---------- data : ndarray or Index unit : str, default "ns" The timedelta unit to treat integers as multiples of. errors : ...
[ "Convert", "a", "object", "-", "dtyped", "or", "string", "-", "dtyped", "array", "into", "an", "timedelta64", "[", "ns", "]", "-", "dtyped", "array", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L990-L1023
[ "def", "objects_to_td64ns", "(", "data", ",", "unit", "=", "\"ns\"", ",", "errors", "=", "\"raise\"", ")", ":", "# coerce Index to np.ndarray, converting string-dtype if necessary", "values", "=", "np", ".", "array", "(", "data", ",", "dtype", "=", "np", ".", "o...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
TimedeltaArray._add_datetime_arraylike
Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray.
pandas/core/arrays/timedeltas.py
def _add_datetime_arraylike(self, other): """ Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray. """ if isinstance(other, np.ndarray): # At this point we have already checked that dtype is datetime64 from pandas.core.arrays import DatetimeArray ...
def _add_datetime_arraylike(self, other): """ Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray. """ if isinstance(other, np.ndarray): # At this point we have already checked that dtype is datetime64 from pandas.core.arrays import DatetimeArray ...
[ "Add", "DatetimeArray", "/", "Index", "or", "ndarray", "[", "datetime64", "]", "to", "TimedeltaArray", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L392-L402
[ "def", "_add_datetime_arraylike", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "np", ".", "ndarray", ")", ":", "# At this point we have already checked that dtype is datetime64", "from", "pandas", ".", "core", ".", "arrays", "import", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
TimedeltaArray.components
Return a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas. Returns ------- a DataFrame
pandas/core/arrays/timedeltas.py
def components(self): """ Return a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas. Returns ------- a DataFrame """ from pandas import DataFrame columns = ['days', 'hours', 'm...
def components(self): """ Return a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas. Returns ------- a DataFrame """ from pandas import DataFrame columns = ['days', 'hours', 'm...
[ "Return", "a", "dataframe", "of", "the", "components", "(", "days", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", ")", "of", "the", "Timedeltas", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/timedeltas.py#L819-L845
[ "def", "components", "(", "self", ")", ":", "from", "pandas", "import", "DataFrame", "columns", "=", "[", "'days'", ",", "'hours'", ",", "'minutes'", ",", "'seconds'", ",", "'milliseconds'", ",", "'microseconds'", ",", "'nanoseconds'", "]", "hasnans", "=", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
register_writer
Add engine to the excel writer registry.io.excel. You must use this method to integrate with ``to_excel``. Parameters ---------- klass : ExcelWriter
pandas/io/excel/_util.py
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): """ 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...
[ "Add", "engine", "to", "the", "excel", "writer", "registry", ".", "io", ".", "excel", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L10-L23
[ "def", "register_writer", "(", "klass", ")", ":", "if", "not", "callable", "(", "klass", ")", ":", "raise", "ValueError", "(", "\"Can only register callables as engines\"", ")", "engine_name", "=", "klass", ".", "engine", "_writers", "[", "engine_name", "]", "="...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_excel2num
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...
pandas/io/excel/_util.py
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): """ 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 ------ ...
[ "Convert", "Excel", "column", "name", "like", "AB", "to", "0", "-", "based", "column", "index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L57-L86
[ "def", "_excel2num", "(", "x", ")", ":", "index", "=", "0", "for", "c", "in", "x", ".", "upper", "(", ")", ".", "strip", "(", ")", ":", "cp", "=", "ord", "(", "c", ")", "if", "cp", "<", "ord", "(", "\"A\"", ")", "or", "cp", ">", "ord", "(...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_range2cols
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') ...
pandas/io/excel/_util.py
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): """ 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 ...
[ "Convert", "comma", "separated", "list", "of", "column", "names", "and", "ranges", "to", "indices", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L89-L119
[ "def", "_range2cols", "(", "areas", ")", ":", "cols", "=", "[", "]", "for", "rng", "in", "areas", ".", "split", "(", "\",\"", ")", ":", "if", "\":\"", "in", "rng", ":", "rng", "=", "rng", ".", "split", "(", "\":\"", ")", "cols", ".", "extend", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037