id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
19,600
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.make_empty
def make_empty(self, axes=None): """ return an empty BlockManager with the items axis of len 0 """ if axes is None: axes = [ensure_index([])] + [ensure_index(a) for a in self.axes[1:]] # preserve dtype if possible if self.ndim == 1: ...
python
def make_empty(self, axes=None): """ return an empty BlockManager with the items axis of len 0 """ if axes is None: axes = [ensure_index([])] + [ensure_index(a) for a in self.axes[1:]] # preserve dtype if possible if self.ndim == 1: ...
[ "def", "make_empty", "(", "self", ",", "axes", "=", "None", ")", ":", "if", "axes", "is", "None", ":", "axes", "=", "[", "ensure_index", "(", "[", "]", ")", "]", "+", "[", "ensure_index", "(", "a", ")", "for", "a", "in", "self", ".", "axes", "[...
return an empty BlockManager with the items axis of len 0
[ "return", "an", "empty", "BlockManager", "with", "the", "items", "axis", "of", "len", "0" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L120-L131
19,601
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.rename_axis
def rename_axis(self, mapper, axis, copy=True, level=None): """ Rename one of axes. Parameters ---------- mapper : unary callable axis : int copy : boolean, default True level : int, default None """ obj = self.copy(deep=copy) obj....
python
def rename_axis(self, mapper, axis, copy=True, level=None): """ Rename one of axes. Parameters ---------- mapper : unary callable axis : int copy : boolean, default True level : int, default None """ obj = self.copy(deep=copy) obj....
[ "def", "rename_axis", "(", "self", ",", "mapper", ",", "axis", ",", "copy", "=", "True", ",", "level", "=", "None", ")", ":", "obj", "=", "self", ".", "copy", "(", "deep", "=", "copy", ")", "obj", ".", "set_axis", "(", "axis", ",", "_transform_inde...
Rename one of axes. Parameters ---------- mapper : unary callable axis : int copy : boolean, default True level : int, default None
[ "Rename", "one", "of", "axes", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L159-L172
19,602
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager._get_counts
def _get_counts(self, f): """ return a dict of the counts of the function in BlockManager """ self._consolidate_inplace() counts = dict() for b in self.blocks: v = f(b) counts[v] = counts.get(v, 0) + b.shape[0] return counts
python
def _get_counts(self, f): """ return a dict of the counts of the function in BlockManager """ self._consolidate_inplace() counts = dict() for b in self.blocks: v = f(b) counts[v] = counts.get(v, 0) + b.shape[0] return counts
[ "def", "_get_counts", "(", "self", ",", "f", ")", ":", "self", ".", "_consolidate_inplace", "(", ")", "counts", "=", "dict", "(", ")", "for", "b", "in", "self", ".", "blocks", ":", "v", "=", "f", "(", "b", ")", "counts", "[", "v", "]", "=", "co...
return a dict of the counts of the function in BlockManager
[ "return", "a", "dict", "of", "the", "counts", "of", "the", "function", "in", "BlockManager" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L210-L217
19,603
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.apply
def apply(self, f, axes=None, filter=None, do_integrity_check=False, consolidate=True, **kwargs): """ iterate over the blocks, collect and create a new block manager Parameters ---------- f : the callable or function name to operate on at the block level ax...
python
def apply(self, f, axes=None, filter=None, do_integrity_check=False, consolidate=True, **kwargs): """ iterate over the blocks, collect and create a new block manager Parameters ---------- f : the callable or function name to operate on at the block level ax...
[ "def", "apply", "(", "self", ",", "f", ",", "axes", "=", "None", ",", "filter", "=", "None", ",", "do_integrity_check", "=", "False", ",", "consolidate", "=", "True", ",", "*", "*", "kwargs", ")", ":", "result_blocks", "=", "[", "]", "# filter kwarg is...
iterate over the blocks, collect and create a new block manager Parameters ---------- f : the callable or function name to operate on at the block level axes : optional (if not supplied, use self.axes) filter : list, if supplied, only call the block if the filter is in ...
[ "iterate", "over", "the", "blocks", "collect", "and", "create", "a", "new", "block", "manager" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L318-L403
19,604
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.quantile
def quantile(self, axis=0, consolidate=True, transposed=False, interpolation='linear', qs=None, numeric_only=None): """ Iterate over blocks applying quantile reduction. This routine is intended for reduction type operations and will do inference on the generated blocks. ...
python
def quantile(self, axis=0, consolidate=True, transposed=False, interpolation='linear', qs=None, numeric_only=None): """ Iterate over blocks applying quantile reduction. This routine is intended for reduction type operations and will do inference on the generated blocks. ...
[ "def", "quantile", "(", "self", ",", "axis", "=", "0", ",", "consolidate", "=", "True", ",", "transposed", "=", "False", ",", "interpolation", "=", "'linear'", ",", "qs", "=", "None", ",", "numeric_only", "=", "None", ")", ":", "# Series dispatches to Data...
Iterate over blocks applying quantile reduction. This routine is intended for reduction type operations and will do inference on the generated blocks. Parameters ---------- axis: reduction axis, default 0 consolidate: boolean, default True. Join together blocks having sa...
[ "Iterate", "over", "blocks", "applying", "quantile", "reduction", ".", "This", "routine", "is", "intended", "for", "reduction", "type", "operations", "and", "will", "do", "inference", "on", "the", "generated", "blocks", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L405-L501
19,605
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.replace_list
def replace_list(self, src_list, dest_list, inplace=False, regex=False): """ do a list replace """ inplace = validate_bool_kwarg(inplace, 'inplace') # figure out our mask a-priori to avoid repeated replacements values = self.as_array() def comp(s, regex=False): """...
python
def replace_list(self, src_list, dest_list, inplace=False, regex=False): """ do a list replace """ inplace = validate_bool_kwarg(inplace, 'inplace') # figure out our mask a-priori to avoid repeated replacements values = self.as_array() def comp(s, regex=False): """...
[ "def", "replace_list", "(", "self", ",", "src_list", ",", "dest_list", ",", "inplace", "=", "False", ",", "regex", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "# figure out our mask a-priori to avoid repeat...
do a list replace
[ "do", "a", "list", "replace" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L539-L585
19,606
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.combine
def combine(self, blocks, copy=True): """ return a new manager with the blocks """ if len(blocks) == 0: return self.make_empty() # FIXME: optimization potential indexer = np.sort(np.concatenate([b.mgr_locs.as_array for b in blocks]))...
python
def combine(self, blocks, copy=True): """ return a new manager with the blocks """ if len(blocks) == 0: return self.make_empty() # FIXME: optimization potential indexer = np.sort(np.concatenate([b.mgr_locs.as_array for b in blocks]))...
[ "def", "combine", "(", "self", ",", "blocks", ",", "copy", "=", "True", ")", ":", "if", "len", "(", "blocks", ")", "==", "0", ":", "return", "self", ".", "make_empty", "(", ")", "# FIXME: optimization potential", "indexer", "=", "np", ".", "sort", "(",...
return a new manager with the blocks
[ "return", "a", "new", "manager", "with", "the", "blocks" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L658-L678
19,607
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.copy
def copy(self, deep=True): """ Make deep or shallow copy of BlockManager Parameters ---------- deep : boolean o rstring, default True If False, return shallow copy (do not copy data) If 'all', copy data and a deep copy of the index Returns ...
python
def copy(self, deep=True): """ Make deep or shallow copy of BlockManager Parameters ---------- deep : boolean o rstring, default True If False, return shallow copy (do not copy data) If 'all', copy data and a deep copy of the index Returns ...
[ "def", "copy", "(", "self", ",", "deep", "=", "True", ")", ":", "# this preserves the notion of view copying of axes", "if", "deep", ":", "if", "deep", "==", "'all'", ":", "copy", "=", "lambda", "ax", ":", "ax", ".", "copy", "(", "deep", "=", "True", ")"...
Make deep or shallow copy of BlockManager Parameters ---------- deep : boolean o rstring, default True If False, return shallow copy (do not copy data) If 'all', copy data and a deep copy of the index Returns ------- copy : BlockManager
[ "Make", "deep", "or", "shallow", "copy", "of", "BlockManager" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L706-L730
19,608
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.as_array
def as_array(self, transpose=False, items=None): """Convert the blockmanager data into an numpy array. Parameters ---------- transpose : boolean, default False If True, transpose the return array items : list of strings or None Names of block items that w...
python
def as_array(self, transpose=False, items=None): """Convert the blockmanager data into an numpy array. Parameters ---------- transpose : boolean, default False If True, transpose the return array items : list of strings or None Names of block items that w...
[ "def", "as_array", "(", "self", ",", "transpose", "=", "False", ",", "items", "=", "None", ")", ":", "if", "len", "(", "self", ".", "blocks", ")", "==", "0", ":", "arr", "=", "np", ".", "empty", "(", "self", ".", "shape", ",", "dtype", "=", "fl...
Convert the blockmanager data into an numpy array. Parameters ---------- transpose : boolean, default False If True, transpose the return array items : list of strings or None Names of block items that will be included in the returned array. ``None`` ...
[ "Convert", "the", "blockmanager", "data", "into", "an", "numpy", "array", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L732-L766
19,609
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager._interleave
def _interleave(self): """ Return ndarray from blocks with specified item order Items must be contained in the blocks """ from pandas.core.dtypes.common import is_sparse dtype = _interleaved_dtype(self.blocks) # TODO: https://github.com/pandas-dev/pandas/issues/2...
python
def _interleave(self): """ Return ndarray from blocks with specified item order Items must be contained in the blocks """ from pandas.core.dtypes.common import is_sparse dtype = _interleaved_dtype(self.blocks) # TODO: https://github.com/pandas-dev/pandas/issues/2...
[ "def", "_interleave", "(", "self", ")", ":", "from", "pandas", ".", "core", ".", "dtypes", ".", "common", "import", "is_sparse", "dtype", "=", "_interleaved_dtype", "(", "self", ".", "blocks", ")", "# TODO: https://github.com/pandas-dev/pandas/issues/22791", "# Give...
Return ndarray from blocks with specified item order Items must be contained in the blocks
[ "Return", "ndarray", "from", "blocks", "with", "specified", "item", "order", "Items", "must", "be", "contained", "in", "the", "blocks" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L768-L795
19,610
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.fast_xs
def fast_xs(self, loc): """ get a cross sectional for a given location in the items ; handle dups return the result, is *could* be a view in the case of a single block """ if len(self.blocks) == 1: return self.blocks[0].iget((slice(None), loc)) ...
python
def fast_xs(self, loc): """ get a cross sectional for a given location in the items ; handle dups return the result, is *could* be a view in the case of a single block """ if len(self.blocks) == 1: return self.blocks[0].iget((slice(None), loc)) ...
[ "def", "fast_xs", "(", "self", ",", "loc", ")", ":", "if", "len", "(", "self", ".", "blocks", ")", "==", "1", ":", "return", "self", ".", "blocks", "[", "0", "]", ".", "iget", "(", "(", "slice", "(", "None", ")", ",", "loc", ")", ")", "items"...
get a cross sectional for a given location in the items ; handle dups return the result, is *could* be a view in the case of a single block
[ "get", "a", "cross", "sectional", "for", "a", "given", "location", "in", "the", "items", ";", "handle", "dups" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L864-L905
19,611
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.consolidate
def consolidate(self): """ Join together blocks having same dtype Returns ------- y : BlockManager """ if self.is_consolidated(): return self bm = self.__class__(self.blocks, self.axes) bm._is_consolidated = False bm._consolid...
python
def consolidate(self): """ Join together blocks having same dtype Returns ------- y : BlockManager """ if self.is_consolidated(): return self bm = self.__class__(self.blocks, self.axes) bm._is_consolidated = False bm._consolid...
[ "def", "consolidate", "(", "self", ")", ":", "if", "self", ".", "is_consolidated", "(", ")", ":", "return", "self", "bm", "=", "self", ".", "__class__", "(", "self", ".", "blocks", ",", "self", ".", "axes", ")", "bm", ".", "_is_consolidated", "=", "F...
Join together blocks having same dtype Returns ------- y : BlockManager
[ "Join", "together", "blocks", "having", "same", "dtype" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L907-L921
19,612
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.iget
def iget(self, i, fastpath=True): """ Return the data as a SingleBlockManager if fastpath=True and possible Otherwise return as a ndarray """ block = self.blocks[self._blknos[i]] values = block.iget(self._blklocs[i]) if not fastpath or not block._box_to_block_val...
python
def iget(self, i, fastpath=True): """ Return the data as a SingleBlockManager if fastpath=True and possible Otherwise return as a ndarray """ block = self.blocks[self._blknos[i]] values = block.iget(self._blklocs[i]) if not fastpath or not block._box_to_block_val...
[ "def", "iget", "(", "self", ",", "i", ",", "fastpath", "=", "True", ")", ":", "block", "=", "self", ".", "blocks", "[", "self", ".", "_blknos", "[", "i", "]", "]", "values", "=", "block", ".", "iget", "(", "self", ".", "_blklocs", "[", "i", "]"...
Return the data as a SingleBlockManager if fastpath=True and possible Otherwise return as a ndarray
[ "Return", "the", "data", "as", "a", "SingleBlockManager", "if", "fastpath", "=", "True", "and", "possible" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L959-L975
19,613
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.insert
def insert(self, loc, item, value, allow_duplicates=False): """ Insert item at selected position. Parameters ---------- loc : int item : hashable value : array_like allow_duplicates: bool If False, trying to insert non-unique item will raise ...
python
def insert(self, loc, item, value, allow_duplicates=False): """ Insert item at selected position. Parameters ---------- loc : int item : hashable value : array_like allow_duplicates: bool If False, trying to insert non-unique item will raise ...
[ "def", "insert", "(", "self", ",", "loc", ",", "item", ",", "value", ",", "allow_duplicates", "=", "False", ")", ":", "if", "not", "allow_duplicates", "and", "item", "in", "self", ".", "items", ":", "# Should this be a different kind of error??", "raise", "Val...
Insert item at selected position. Parameters ---------- loc : int item : hashable value : array_like allow_duplicates: bool If False, trying to insert non-unique item will raise
[ "Insert", "item", "at", "selected", "position", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1130-L1180
19,614
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.reindex_axis
def reindex_axis(self, new_index, axis, method=None, limit=None, fill_value=None, copy=True): """ Conform block manager to new index. """ new_index = ensure_index(new_index) new_index, indexer = self.axes[axis].reindex(new_index, method=method, ...
python
def reindex_axis(self, new_index, axis, method=None, limit=None, fill_value=None, copy=True): """ Conform block manager to new index. """ new_index = ensure_index(new_index) new_index, indexer = self.axes[axis].reindex(new_index, method=method, ...
[ "def", "reindex_axis", "(", "self", ",", "new_index", ",", "axis", ",", "method", "=", "None", ",", "limit", "=", "None", ",", "fill_value", "=", "None", ",", "copy", "=", "True", ")", ":", "new_index", "=", "ensure_index", "(", "new_index", ")", "new_...
Conform block manager to new index.
[ "Conform", "block", "manager", "to", "new", "index", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1182-L1192
19,615
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.take
def take(self, indexer, axis=1, verify=True, convert=True): """ Take items along any axis. """ self._consolidate_inplace() indexer = (np.arange(indexer.start, indexer.stop, indexer.step, dtype='int64') if isinstance(indexer, slice) ...
python
def take(self, indexer, axis=1, verify=True, convert=True): """ Take items along any axis. """ self._consolidate_inplace() indexer = (np.arange(indexer.start, indexer.stop, indexer.step, dtype='int64') if isinstance(indexer, slice) ...
[ "def", "take", "(", "self", ",", "indexer", ",", "axis", "=", "1", ",", "verify", "=", "True", ",", "convert", "=", "True", ")", ":", "self", ".", "_consolidate_inplace", "(", ")", "indexer", "=", "(", "np", ".", "arange", "(", "indexer", ".", "sta...
Take items along any axis.
[ "Take", "items", "along", "any", "axis", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1325-L1346
19,616
pandas-dev/pandas
pandas/core/internals/managers.py
BlockManager.unstack
def unstack(self, unstacker_func, fill_value): """Return a blockmanager with all blocks unstacked. Parameters ---------- unstacker_func : callable A (partially-applied) ``pd.core.reshape._Unstacker`` class. fill_value : Any fill_value for newly introduced...
python
def unstack(self, unstacker_func, fill_value): """Return a blockmanager with all blocks unstacked. Parameters ---------- unstacker_func : callable A (partially-applied) ``pd.core.reshape._Unstacker`` class. fill_value : Any fill_value for newly introduced...
[ "def", "unstack", "(", "self", ",", "unstacker_func", ",", "fill_value", ")", ":", "n_rows", "=", "self", ".", "shape", "[", "-", "1", "]", "dummy", "=", "unstacker_func", "(", "np", ".", "empty", "(", "(", "0", ",", "0", ")", ")", ",", "value_colu...
Return a blockmanager with all blocks unstacked. Parameters ---------- unstacker_func : callable A (partially-applied) ``pd.core.reshape._Unstacker`` class. fill_value : Any fill_value for newly introduced missing values. Returns ------- ...
[ "Return", "a", "blockmanager", "with", "all", "blocks", "unstacked", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1392-L1428
19,617
pandas-dev/pandas
pandas/core/internals/managers.py
SingleBlockManager.delete
def delete(self, item): """ Delete single item from SingleBlockManager. Ensures that self.blocks doesn't become empty. """ loc = self.items.get_loc(item) self._block.delete(loc) self.axes[0] = self.axes[0].delete(loc)
python
def delete(self, item): """ Delete single item from SingleBlockManager. Ensures that self.blocks doesn't become empty. """ loc = self.items.get_loc(item) self._block.delete(loc) self.axes[0] = self.axes[0].delete(loc)
[ "def", "delete", "(", "self", ",", "item", ")", ":", "loc", "=", "self", ".", "items", ".", "get_loc", "(", "item", ")", "self", ".", "_block", ".", "delete", "(", "loc", ")", "self", ".", "axes", "[", "0", "]", "=", "self", ".", "axes", "[", ...
Delete single item from SingleBlockManager. Ensures that self.blocks doesn't become empty.
[ "Delete", "single", "item", "from", "SingleBlockManager", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1577-L1585
19,618
pandas-dev/pandas
pandas/core/internals/managers.py
SingleBlockManager.concat
def concat(self, to_concat, new_axis): """ Concatenate a list of SingleBlockManagers into a single SingleBlockManager. Used for pd.concat of Series objects with axis=0. Parameters ---------- to_concat : list of SingleBlockManagers new_axis : Index of the...
python
def concat(self, to_concat, new_axis): """ Concatenate a list of SingleBlockManagers into a single SingleBlockManager. Used for pd.concat of Series objects with axis=0. Parameters ---------- to_concat : list of SingleBlockManagers new_axis : Index of the...
[ "def", "concat", "(", "self", ",", "to_concat", ",", "new_axis", ")", ":", "non_empties", "=", "[", "x", "for", "x", "in", "to_concat", "if", "len", "(", "x", ")", ">", "0", "]", "# check if all series are of the same block type:", "if", "len", "(", "non_e...
Concatenate a list of SingleBlockManagers into a single SingleBlockManager. Used for pd.concat of Series objects with axis=0. Parameters ---------- to_concat : list of SingleBlockManagers new_axis : Index of the result Returns ------- SingleBloc...
[ "Concatenate", "a", "list", "of", "SingleBlockManagers", "into", "a", "single", "SingleBlockManager", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1594-L1630
19,619
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.from_array
def from_array(cls, arr, index=None, name=None, copy=False, fill_value=None, fastpath=False): """Construct SparseSeries from array. .. deprecated:: 0.23.0 Use the pd.SparseSeries(..) constructor instead. """ warnings.warn("'from_array' is deprecated and wi...
python
def from_array(cls, arr, index=None, name=None, copy=False, fill_value=None, fastpath=False): """Construct SparseSeries from array. .. deprecated:: 0.23.0 Use the pd.SparseSeries(..) constructor instead. """ warnings.warn("'from_array' is deprecated and wi...
[ "def", "from_array", "(", "cls", ",", "arr", ",", "index", "=", "None", ",", "name", "=", "None", ",", "copy", "=", "False", ",", "fill_value", "=", "None", ",", "fastpath", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"'from_array' is depre...
Construct SparseSeries from array. .. deprecated:: 0.23.0 Use the pd.SparseSeries(..) constructor instead.
[ "Construct", "SparseSeries", "from", "array", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L181-L192
19,620
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.as_sparse_array
def as_sparse_array(self, kind=None, fill_value=None, copy=False): """ return my self as a sparse array, do not copy by default """ if fill_value is None: fill_value = self.fill_value if kind is None: kind = self.kind return SparseArray(self.values, sparse_index=...
python
def as_sparse_array(self, kind=None, fill_value=None, copy=False): """ return my self as a sparse array, do not copy by default """ if fill_value is None: fill_value = self.fill_value if kind is None: kind = self.kind return SparseArray(self.values, sparse_index=...
[ "def", "as_sparse_array", "(", "self", ",", "kind", "=", "None", ",", "fill_value", "=", "None", ",", "copy", "=", "False", ")", ":", "if", "fill_value", "is", "None", ":", "fill_value", "=", "self", ".", "fill_value", "if", "kind", "is", "None", ":", ...
return my self as a sparse array, do not copy by default
[ "return", "my", "self", "as", "a", "sparse", "array", "do", "not", "copy", "by", "default" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L210-L218
19,621
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries._reduce
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds): """ perform a reduction operation """ return op(self.get_values(), skipna=skipna, **kwds)
python
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds): """ perform a reduction operation """ return op(self.get_values(), skipna=skipna, **kwds)
[ "def", "_reduce", "(", "self", ",", "op", ",", "name", ",", "axis", "=", "0", ",", "skipna", "=", "True", ",", "numeric_only", "=", "None", ",", "filter_type", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "op", "(", "self", ".", "get_v...
perform a reduction operation
[ "perform", "a", "reduction", "operation" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L227-L230
19,622
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries._ixs
def _ixs(self, i, axis=0): """ Return the i-th value or values in the SparseSeries by location Parameters ---------- i : int, slice, or sequence of integers Returns ------- value : scalar (int) or Series (slice, sequence) """ label = self...
python
def _ixs(self, i, axis=0): """ Return the i-th value or values in the SparseSeries by location Parameters ---------- i : int, slice, or sequence of integers Returns ------- value : scalar (int) or Series (slice, sequence) """ label = self...
[ "def", "_ixs", "(", "self", ",", "i", ",", "axis", "=", "0", ")", ":", "label", "=", "self", ".", "index", "[", "i", "]", "if", "isinstance", "(", "label", ",", "Index", ")", ":", "return", "self", ".", "take", "(", "i", ",", "axis", "=", "ax...
Return the i-th value or values in the SparseSeries by location Parameters ---------- i : int, slice, or sequence of integers Returns ------- value : scalar (int) or Series (slice, sequence)
[ "Return", "the", "i", "-", "th", "value", "or", "values", "in", "the", "SparseSeries", "by", "location" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L268-L284
19,623
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.abs
def abs(self): """ Return an object with absolute value taken. Only applicable to objects that are all numeric Returns ------- abs: same type as caller """ return self._constructor(np.abs(self.values), index=self.index).__...
python
def abs(self): """ Return an object with absolute value taken. Only applicable to objects that are all numeric Returns ------- abs: same type as caller """ return self._constructor(np.abs(self.values), index=self.index).__...
[ "def", "abs", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "np", ".", "abs", "(", "self", ".", "values", ")", ",", "index", "=", "self", ".", "index", ")", ".", "__finalize__", "(", "self", ")" ]
Return an object with absolute value taken. Only applicable to objects that are all numeric Returns ------- abs: same type as caller
[ "Return", "an", "object", "with", "absolute", "value", "taken", ".", "Only", "applicable", "to", "objects", "that", "are", "all", "numeric" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L308-L318
19,624
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.get
def get(self, label, default=None): """ Returns value occupying requested label, default to specified missing value if not present. Analogous to dict.get Parameters ---------- label : object Label value looking for default : object, optional ...
python
def get(self, label, default=None): """ Returns value occupying requested label, default to specified missing value if not present. Analogous to dict.get Parameters ---------- label : object Label value looking for default : object, optional ...
[ "def", "get", "(", "self", ",", "label", ",", "default", "=", "None", ")", ":", "if", "label", "in", "self", ".", "index", ":", "loc", "=", "self", ".", "index", ".", "get_loc", "(", "label", ")", "return", "self", ".", "_get_val_at", "(", "loc", ...
Returns value occupying requested label, default to specified missing value if not present. Analogous to dict.get Parameters ---------- label : object Label value looking for default : object, optional Value to return if label not in index Return...
[ "Returns", "value", "occupying", "requested", "label", "default", "to", "specified", "missing", "value", "if", "not", "present", ".", "Analogous", "to", "dict", ".", "get" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L320-L340
19,625
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.get_value
def get_value(self, label, takeable=False): """ Retrieve single value at passed index label .. deprecated:: 0.21.0 Please use .at[] or .iat[] accessors. Parameters ---------- index : label takeable : interpret the index as indexers, default False ...
python
def get_value(self, label, takeable=False): """ Retrieve single value at passed index label .. deprecated:: 0.21.0 Please use .at[] or .iat[] accessors. Parameters ---------- index : label takeable : interpret the index as indexers, default False ...
[ "def", "get_value", "(", "self", ",", "label", ",", "takeable", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"get_value is deprecated and will be removed \"", "\"in a future release. Please use \"", "\".at[] or .iat[] accessors instead\"", ",", "FutureWarning", "...
Retrieve single value at passed index label .. deprecated:: 0.21.0 Please use .at[] or .iat[] accessors. Parameters ---------- index : label takeable : interpret the index as indexers, default False Returns ------- value : scalar value
[ "Retrieve", "single", "value", "at", "passed", "index", "label" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L342-L364
19,626
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.set_value
def set_value(self, label, value, takeable=False): """ Quickly set single value at passed label. If label is not contained, a new object is created with the label placed at the end of the result index .. deprecated:: 0.21.0 Please use .at[] or .iat[] accessors. ...
python
def set_value(self, label, value, takeable=False): """ Quickly set single value at passed label. If label is not contained, a new object is created with the label placed at the end of the result index .. deprecated:: 0.21.0 Please use .at[] or .iat[] accessors. ...
[ "def", "set_value", "(", "self", ",", "label", ",", "value", ",", "takeable", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"set_value is deprecated and will be removed \"", "\"in a future release. Please use \"", "\".at[] or .iat[] accessors instead\"", ",", "F...
Quickly set single value at passed label. If label is not contained, a new object is created with the label placed at the end of the result index .. deprecated:: 0.21.0 Please use .at[] or .iat[] accessors. Parameters ---------- label : object Parti...
[ "Quickly", "set", "single", "value", "at", "passed", "label", ".", "If", "label", "is", "not", "contained", "a", "new", "object", "is", "created", "with", "the", "label", "placed", "at", "the", "end", "of", "the", "result", "index" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L371-L402
19,627
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.to_dense
def to_dense(self): """ Convert SparseSeries to a Series. Returns ------- s : Series """ return Series(self.values.to_dense(), index=self.index, name=self.name)
python
def to_dense(self): """ Convert SparseSeries to a Series. Returns ------- s : Series """ return Series(self.values.to_dense(), index=self.index, name=self.name)
[ "def", "to_dense", "(", "self", ")", ":", "return", "Series", "(", "self", ".", "values", ".", "to_dense", "(", ")", ",", "index", "=", "self", ".", "index", ",", "name", "=", "self", ".", "name", ")" ]
Convert SparseSeries to a Series. Returns ------- s : Series
[ "Convert", "SparseSeries", "to", "a", "Series", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L434-L443
19,628
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.copy
def copy(self, deep=True): """ Make a copy of the SparseSeries. Only the actual sparse values need to be copied """ # TODO: https://github.com/pandas-dev/pandas/issues/22314 # We skip the block manager till that is resolved. new_data = self.values.copy(deep=deep) ...
python
def copy(self, deep=True): """ Make a copy of the SparseSeries. Only the actual sparse values need to be copied """ # TODO: https://github.com/pandas-dev/pandas/issues/22314 # We skip the block manager till that is resolved. new_data = self.values.copy(deep=deep) ...
[ "def", "copy", "(", "self", ",", "deep", "=", "True", ")", ":", "# TODO: https://github.com/pandas-dev/pandas/issues/22314", "# We skip the block manager till that is resolved.", "new_data", "=", "self", ".", "values", ".", "copy", "(", "deep", "=", "deep", ")", "retu...
Make a copy of the SparseSeries. Only the actual sparse values need to be copied
[ "Make", "a", "copy", "of", "the", "SparseSeries", ".", "Only", "the", "actual", "sparse", "values", "need", "to", "be", "copied" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L449-L460
19,629
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.sparse_reindex
def sparse_reindex(self, new_index): """ Conform sparse values to new SparseIndex Parameters ---------- new_index : {BlockIndex, IntIndex} Returns ------- reindexed : SparseSeries """ if not isinstance(new_index, splib.SparseIndex): ...
python
def sparse_reindex(self, new_index): """ Conform sparse values to new SparseIndex Parameters ---------- new_index : {BlockIndex, IntIndex} Returns ------- reindexed : SparseSeries """ if not isinstance(new_index, splib.SparseIndex): ...
[ "def", "sparse_reindex", "(", "self", ",", "new_index", ")", ":", "if", "not", "isinstance", "(", "new_index", ",", "splib", ".", "SparseIndex", ")", ":", "raise", "TypeError", "(", "\"new index must be a SparseIndex\"", ")", "values", "=", "self", ".", "value...
Conform sparse values to new SparseIndex Parameters ---------- new_index : {BlockIndex, IntIndex} Returns ------- reindexed : SparseSeries
[ "Conform", "sparse", "values", "to", "new", "SparseIndex" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L470-L490
19,630
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.dropna
def dropna(self, axis=0, inplace=False, **kwargs): """ Analogous to Series.dropna. If fill_value=NaN, returns a dense Series """ # TODO: make more efficient # Validate axis self._get_axis_number(axis or 0) dense_valid = self.to_dense().dropna() if inplace:...
python
def dropna(self, axis=0, inplace=False, **kwargs): """ Analogous to Series.dropna. If fill_value=NaN, returns a dense Series """ # TODO: make more efficient # Validate axis self._get_axis_number(axis or 0) dense_valid = self.to_dense().dropna() if inplace:...
[ "def", "dropna", "(", "self", ",", "axis", "=", "0", ",", "inplace", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# TODO: make more efficient", "# Validate axis", "self", ".", "_get_axis_number", "(", "axis", "or", "0", ")", "dense_valid", "=", "self"...
Analogous to Series.dropna. If fill_value=NaN, returns a dense Series
[ "Analogous", "to", "Series", ".", "dropna", ".", "If", "fill_value", "=", "NaN", "returns", "a", "dense", "Series" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L537-L552
19,631
pandas-dev/pandas
pandas/core/sparse/series.py
SparseSeries.combine_first
def combine_first(self, other): """ Combine Series values, choosing the calling Series's values first. Result index will be the union of the two indexes Parameters ---------- other : Series Returns ------- y : Series """ if isinst...
python
def combine_first(self, other): """ Combine Series values, choosing the calling Series's values first. Result index will be the union of the two indexes Parameters ---------- other : Series Returns ------- y : Series """ if isinst...
[ "def", "combine_first", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "SparseSeries", ")", ":", "other", "=", "other", ".", "to_dense", "(", ")", "dense_combined", "=", "self", ".", "to_dense", "(", ")", ".", "combine_first"...
Combine Series values, choosing the calling Series's values first. Result index will be the union of the two indexes Parameters ---------- other : Series Returns ------- y : Series
[ "Combine", "Series", "values", "choosing", "the", "calling", "Series", "s", "values", "first", ".", "Result", "index", "will", "be", "the", "union", "of", "the", "two", "indexes" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/sparse/series.py#L554-L571
19,632
pandas-dev/pandas
pandas/core/tools/datetimes.py
_maybe_cache
def _maybe_cache(arg, format, cache, convert_listlike): """ Create a cache of unique dates from an array of dates Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series format : string Strftime format to parse time cache : boolean True a...
python
def _maybe_cache(arg, format, cache, convert_listlike): """ Create a cache of unique dates from an array of dates Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series format : string Strftime format to parse time cache : boolean True a...
[ "def", "_maybe_cache", "(", "arg", ",", "format", ",", "cache", ",", "convert_listlike", ")", ":", "from", "pandas", "import", "Series", "cache_array", "=", "Series", "(", ")", "if", "cache", ":", "# Perform a quicker unique check", "from", "pandas", "import", ...
Create a cache of unique dates from an array of dates Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series format : string Strftime format to parse time cache : boolean True attempts to create a cache of converted values convert_listlike :...
[ "Create", "a", "cache", "of", "unique", "dates", "from", "an", "array", "of", "dates" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/tools/datetimes.py#L31-L60
19,633
pandas-dev/pandas
pandas/core/tools/datetimes.py
_convert_and_box_cache
def _convert_and_box_cache(arg, cache_array, box, errors, name=None): """ Convert array of dates with a cache and box the result Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series cache_array : Series Cache of converted, unique dates box : b...
python
def _convert_and_box_cache(arg, cache_array, box, errors, name=None): """ Convert array of dates with a cache and box the result Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series cache_array : Series Cache of converted, unique dates box : b...
[ "def", "_convert_and_box_cache", "(", "arg", ",", "cache_array", ",", "box", ",", "errors", ",", "name", "=", "None", ")", ":", "from", "pandas", "import", "Series", ",", "DatetimeIndex", ",", "Index", "result", "=", "Series", "(", "arg", ")", ".", "map"...
Convert array of dates with a cache and box the result Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series cache_array : Series Cache of converted, unique dates box : boolean True boxes result as an Index-like, False returns an ndarray er...
[ "Convert", "array", "of", "dates", "with", "a", "cache", "and", "box", "the", "result" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/tools/datetimes.py#L63-L94
19,634
pandas-dev/pandas
pandas/core/tools/datetimes.py
_return_parsed_timezone_results
def _return_parsed_timezone_results(result, timezones, box, tz, name): """ Return results from array_strptime if a %z or %Z directive was passed. Parameters ---------- result : ndarray int64 date representations of the dates timezones : ndarray pytz timezone objects box : bo...
python
def _return_parsed_timezone_results(result, timezones, box, tz, name): """ Return results from array_strptime if a %z or %Z directive was passed. Parameters ---------- result : ndarray int64 date representations of the dates timezones : ndarray pytz timezone objects box : bo...
[ "def", "_return_parsed_timezone_results", "(", "result", ",", "timezones", ",", "box", ",", "tz", ",", "name", ")", ":", "if", "tz", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Cannot pass a tz argument when \"", "\"parsing strings with timezone \"", "\...
Return results from array_strptime if a %z or %Z directive was passed. Parameters ---------- result : ndarray int64 date representations of the dates timezones : ndarray pytz timezone objects box : boolean True boxes result as an Index-like, False returns an ndarray tz :...
[ "Return", "results", "from", "array_strptime", "if", "a", "%z", "or", "%Z", "directive", "was", "passed", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/tools/datetimes.py#L97-L132
19,635
pandas-dev/pandas
pandas/core/tools/datetimes.py
_adjust_to_origin
def _adjust_to_origin(arg, origin, unit): """ Helper function for to_datetime. Adjust input argument to the specified origin Parameters ---------- arg : list, tuple, ndarray, Series, Index date to be adjusted origin : 'julian' or Timestamp origin offset for the arg unit ...
python
def _adjust_to_origin(arg, origin, unit): """ Helper function for to_datetime. Adjust input argument to the specified origin Parameters ---------- arg : list, tuple, ndarray, Series, Index date to be adjusted origin : 'julian' or Timestamp origin offset for the arg unit ...
[ "def", "_adjust_to_origin", "(", "arg", ",", "origin", ",", "unit", ")", ":", "if", "origin", "==", "'julian'", ":", "original", "=", "arg", "j0", "=", "Timestamp", "(", "0", ")", ".", "to_julian_date", "(", ")", "if", "unit", "!=", "'D'", ":", "rais...
Helper function for to_datetime. Adjust input argument to the specified origin Parameters ---------- arg : list, tuple, ndarray, Series, Index date to be adjusted origin : 'julian' or Timestamp origin offset for the arg unit : string passed unit from to_datetime, must be...
[ "Helper", "function", "for", "to_datetime", ".", "Adjust", "input", "argument", "to", "the", "specified", "origin" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/tools/datetimes.py#L329-L399
19,636
pandas-dev/pandas
pandas/core/tools/datetimes.py
to_datetime
def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, utc=None, box=True, format=None, exact=True, unit=None, infer_datetime_format=False, origin='unix', cache=False): """ Convert argument to datetime. Parameters ---------- arg : integ...
python
def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, utc=None, box=True, format=None, exact=True, unit=None, infer_datetime_format=False, origin='unix', cache=False): """ Convert argument to datetime. Parameters ---------- arg : integ...
[ "def", "to_datetime", "(", "arg", ",", "errors", "=", "'raise'", ",", "dayfirst", "=", "False", ",", "yearfirst", "=", "False", ",", "utc", "=", "None", ",", "box", "=", "True", ",", "format", "=", "None", ",", "exact", "=", "True", ",", "unit", "=...
Convert argument to datetime. Parameters ---------- arg : integer, float, string, datetime, list, tuple, 1-d array, Series .. versionadded:: 0.18.1 or DataFrame/dict-like errors : {'ignore', 'raise', 'coerce'}, default 'raise' - If 'raise', then invalid parsing will raise...
[ "Convert", "argument", "to", "datetime", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/tools/datetimes.py#L403-L622
19,637
pandas-dev/pandas
pandas/util/_decorators.py
deprecate
def deprecate(name, alternative, version, alt_name=None, klass=None, stacklevel=2, msg=None): """ Return a new function that emits a deprecation warning on use. To use this method for a deprecated function, another function `alternative` with the same signature must exist. The deprecated ...
python
def deprecate(name, alternative, version, alt_name=None, klass=None, stacklevel=2, msg=None): """ Return a new function that emits a deprecation warning on use. To use this method for a deprecated function, another function `alternative` with the same signature must exist. The deprecated ...
[ "def", "deprecate", "(", "name", ",", "alternative", ",", "version", ",", "alt_name", "=", "None", ",", "klass", "=", "None", ",", "stacklevel", "=", "2", ",", "msg", "=", "None", ")", ":", "alt_name", "=", "alt_name", "or", "alternative", ".", "__name...
Return a new function that emits a deprecation warning on use. To use this method for a deprecated function, another function `alternative` with the same signature must exist. The deprecated function will emit a deprecation warning, and in the docstring it will contain the deprecation directive with th...
[ "Return", "a", "new", "function", "that", "emits", "a", "deprecation", "warning", "on", "use", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_decorators.py#L9-L74
19,638
pandas-dev/pandas
pandas/util/_decorators.py
deprecate_kwarg
def deprecate_kwarg(old_arg_name, new_arg_name, mapping=None, stacklevel=2): """ Decorator to deprecate a keyword argument of a function. Parameters ---------- old_arg_name : str Name of argument in function to deprecate new_arg_name : str or None Name of preferred argument in f...
python
def deprecate_kwarg(old_arg_name, new_arg_name, mapping=None, stacklevel=2): """ Decorator to deprecate a keyword argument of a function. Parameters ---------- old_arg_name : str Name of argument in function to deprecate new_arg_name : str or None Name of preferred argument in f...
[ "def", "deprecate_kwarg", "(", "old_arg_name", ",", "new_arg_name", ",", "mapping", "=", "None", ",", "stacklevel", "=", "2", ")", ":", "if", "mapping", "is", "not", "None", "and", "not", "hasattr", "(", "mapping", ",", "'get'", ")", "and", "not", "calla...
Decorator to deprecate a keyword argument of a function. Parameters ---------- old_arg_name : str Name of argument in function to deprecate new_arg_name : str or None Name of preferred argument in function. Use None to raise warning that ``old_arg_name`` keyword is deprecated. ...
[ "Decorator", "to", "deprecate", "a", "keyword", "argument", "of", "a", "function", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_decorators.py#L77-L190
19,639
pandas-dev/pandas
pandas/util/_decorators.py
make_signature
def make_signature(func): """ Returns a tuple containing the paramenter list with defaults and parameter list. Examples -------- >>> def f(a, b, c=2): >>> return a * b * c >>> print(make_signature(f)) (['a', 'b', 'c=2'], ['a', 'b', 'c']) """ spec = inspect.getfullargspe...
python
def make_signature(func): """ Returns a tuple containing the paramenter list with defaults and parameter list. Examples -------- >>> def f(a, b, c=2): >>> return a * b * c >>> print(make_signature(f)) (['a', 'b', 'c=2'], ['a', 'b', 'c']) """ spec = inspect.getfullargspe...
[ "def", "make_signature", "(", "func", ")", ":", "spec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "if", "spec", ".", "defaults", "is", "None", ":", "n_wo_defaults", "=", "len", "(", "spec", ".", "args", ")", "defaults", "=", "(", "''", ...
Returns a tuple containing the paramenter list with defaults and parameter list. Examples -------- >>> def f(a, b, c=2): >>> return a * b * c >>> print(make_signature(f)) (['a', 'b', 'c=2'], ['a', 'b', 'c'])
[ "Returns", "a", "tuple", "containing", "the", "paramenter", "list", "with", "defaults", "and", "parameter", "list", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_decorators.py#L324-L351
19,640
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex.from_range
def from_range(cls, data, name=None, dtype=None, **kwargs): """ Create RangeIndex from a range object. """ if not isinstance(data, range): raise TypeError( '{0}(...) must be called with object coercible to a ' 'range, {1} was passed'.format(cls.__name__, repr(...
python
def from_range(cls, data, name=None, dtype=None, **kwargs): """ Create RangeIndex from a range object. """ if not isinstance(data, range): raise TypeError( '{0}(...) must be called with object coercible to a ' 'range, {1} was passed'.format(cls.__name__, repr(...
[ "def", "from_range", "(", "cls", ",", "data", ",", "name", "=", "None", ",", "dtype", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "data", ",", "range", ")", ":", "raise", "TypeError", "(", "'{0}(...) must be called w...
Create RangeIndex from a range object.
[ "Create", "RangeIndex", "from", "a", "range", "object", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L128-L136
19,641
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex.min
def min(self, axis=None, skipna=True): """The minimum value of the RangeIndex""" nv.validate_minmax_axis(axis) return self._minmax('min')
python
def min(self, axis=None, skipna=True): """The minimum value of the RangeIndex""" nv.validate_minmax_axis(axis) return self._minmax('min')
[ "def", "min", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ")", ":", "nv", ".", "validate_minmax_axis", "(", "axis", ")", "return", "self", ".", "_minmax", "(", "'min'", ")" ]
The minimum value of the RangeIndex
[ "The", "minimum", "value", "of", "the", "RangeIndex" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L325-L328
19,642
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex.max
def max(self, axis=None, skipna=True): """The maximum value of the RangeIndex""" nv.validate_minmax_axis(axis) return self._minmax('max')
python
def max(self, axis=None, skipna=True): """The maximum value of the RangeIndex""" nv.validate_minmax_axis(axis) return self._minmax('max')
[ "def", "max", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ")", ":", "nv", ".", "validate_minmax_axis", "(", "axis", ")", "return", "self", ".", "_minmax", "(", "'max'", ")" ]
The maximum value of the RangeIndex
[ "The", "maximum", "value", "of", "the", "RangeIndex" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L330-L333
19,643
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex.argsort
def argsort(self, *args, **kwargs): """ Returns the indices that would sort the index and its underlying data. Returns ------- argsorted : numpy array See Also -------- numpy.ndarray.argsort """ nv.validate_argsort(args, kwargs) ...
python
def argsort(self, *args, **kwargs): """ Returns the indices that would sort the index and its underlying data. Returns ------- argsorted : numpy array See Also -------- numpy.ndarray.argsort """ nv.validate_argsort(args, kwargs) ...
[ "def", "argsort", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_argsort", "(", "args", ",", "kwargs", ")", "if", "self", ".", "_step", ">", "0", ":", "return", "np", ".", "arange", "(", "len", "(", "self",...
Returns the indices that would sort the index and its underlying data. Returns ------- argsorted : numpy array See Also -------- numpy.ndarray.argsort
[ "Returns", "the", "indices", "that", "would", "sort", "the", "index", "and", "its", "underlying", "data", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L335-L353
19,644
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex._min_fitting_element
def _min_fitting_element(self, lower_limit): """Returns the smallest element greater than or equal to the limit""" no_steps = -(-(lower_limit - self._start) // abs(self._step)) return self._start + abs(self._step) * no_steps
python
def _min_fitting_element(self, lower_limit): """Returns the smallest element greater than or equal to the limit""" no_steps = -(-(lower_limit - self._start) // abs(self._step)) return self._start + abs(self._step) * no_steps
[ "def", "_min_fitting_element", "(", "self", ",", "lower_limit", ")", ":", "no_steps", "=", "-", "(", "-", "(", "lower_limit", "-", "self", ".", "_start", ")", "//", "abs", "(", "self", ".", "_step", ")", ")", "return", "self", ".", "_start", "+", "ab...
Returns the smallest element greater than or equal to the limit
[ "Returns", "the", "smallest", "element", "greater", "than", "or", "equal", "to", "the", "limit" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L439-L442
19,645
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex._max_fitting_element
def _max_fitting_element(self, upper_limit): """Returns the largest element smaller than or equal to the limit""" no_steps = (upper_limit - self._start) // abs(self._step) return self._start + abs(self._step) * no_steps
python
def _max_fitting_element(self, upper_limit): """Returns the largest element smaller than or equal to the limit""" no_steps = (upper_limit - self._start) // abs(self._step) return self._start + abs(self._step) * no_steps
[ "def", "_max_fitting_element", "(", "self", ",", "upper_limit", ")", ":", "no_steps", "=", "(", "upper_limit", "-", "self", ".", "_start", ")", "//", "abs", "(", "self", ".", "_step", ")", "return", "self", ".", "_start", "+", "abs", "(", "self", ".", ...
Returns the largest element smaller than or equal to the limit
[ "Returns", "the", "largest", "element", "smaller", "than", "or", "equal", "to", "the", "limit" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L444-L447
19,646
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex.union
def union(self, other, sort=None): """ Form the union of two Index objects and sorts if possible Parameters ---------- other : Index or array-like sort : False or None, default None Whether to sort resulting index. ``sort=None`` returns a mononot...
python
def union(self, other, sort=None): """ Form the union of two Index objects and sorts if possible Parameters ---------- other : Index or array-like sort : False or None, default None Whether to sort resulting index. ``sort=None`` returns a mononot...
[ "def", "union", "(", "self", ",", "other", ",", "sort", "=", "None", ")", ":", "self", ".", "_assert_can_do_setop", "(", "other", ")", "if", "len", "(", "other", ")", "==", "0", "or", "self", ".", "equals", "(", "other", ")", "or", "len", "(", "s...
Form the union of two Index objects and sorts if possible Parameters ---------- other : Index or array-like sort : False or None, default None Whether to sort resulting index. ``sort=None`` returns a mononotically increasing ``RangeIndex`` if possible or a sorte...
[ "Form", "the", "union", "of", "two", "Index", "objects", "and", "sorts", "if", "possible" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L466-L527
19,647
pandas-dev/pandas
pandas/core/indexes/range.py
RangeIndex._add_numeric_methods_binary
def _add_numeric_methods_binary(cls): """ add in numeric methods, specialized to RangeIndex """ def _make_evaluate_binop(op, step=False): """ Parameters ---------- op : callable that accepts 2 parms perform the binary op step :...
python
def _add_numeric_methods_binary(cls): """ add in numeric methods, specialized to RangeIndex """ def _make_evaluate_binop(op, step=False): """ Parameters ---------- op : callable that accepts 2 parms perform the binary op step :...
[ "def", "_add_numeric_methods_binary", "(", "cls", ")", ":", "def", "_make_evaluate_binop", "(", "op", ",", "step", "=", "False", ")", ":", "\"\"\"\n Parameters\n ----------\n op : callable that accepts 2 parms\n perform the binary op\n ...
add in numeric methods, specialized to RangeIndex
[ "add", "in", "numeric", "methods", "specialized", "to", "RangeIndex" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/range.py#L644-L727
19,648
pandas-dev/pandas
pandas/io/formats/printing.py
adjoin
def adjoin(space, *lists, **kwargs): """ Glues together two sets of strings using the amount of space requested. The idea is to prettify. ---------- space : int number of spaces for padding lists : str list of str which being joined strlen : callable function used to...
python
def adjoin(space, *lists, **kwargs): """ Glues together two sets of strings using the amount of space requested. The idea is to prettify. ---------- space : int number of spaces for padding lists : str list of str which being joined strlen : callable function used to...
[ "def", "adjoin", "(", "space", ",", "*", "lists", ",", "*", "*", "kwargs", ")", ":", "strlen", "=", "kwargs", ".", "pop", "(", "'strlen'", ",", "len", ")", "justfunc", "=", "kwargs", ".", "pop", "(", "'justfunc'", ",", "justify", ")", "out_lines", ...
Glues together two sets of strings using the amount of space requested. The idea is to prettify. ---------- space : int number of spaces for padding lists : str list of str which being joined strlen : callable function used to calculate the length of each str. Needed for uni...
[ "Glues", "together", "two", "sets", "of", "strings", "using", "the", "amount", "of", "space", "requested", ".", "The", "idea", "is", "to", "prettify", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/printing.py#L12-L44
19,649
pandas-dev/pandas
pandas/io/gbq.py
read_gbq
def read_gbq(query, project_id=None, index_col=None, col_order=None, reauth=False, auth_local_webserver=False, dialect=None, location=None, configuration=None, credentials=None, use_bqstorage_api=None, private_key=None, verbose=None): """ Load data from Google BigQuery. ...
python
def read_gbq(query, project_id=None, index_col=None, col_order=None, reauth=False, auth_local_webserver=False, dialect=None, location=None, configuration=None, credentials=None, use_bqstorage_api=None, private_key=None, verbose=None): """ Load data from Google BigQuery. ...
[ "def", "read_gbq", "(", "query", ",", "project_id", "=", "None", ",", "index_col", "=", "None", ",", "col_order", "=", "None", ",", "reauth", "=", "False", ",", "auth_local_webserver", "=", "False", ",", "dialect", "=", "None", ",", "location", "=", "Non...
Load data from Google BigQuery. This function requires the `pandas-gbq package <https://pandas-gbq.readthedocs.io>`__. See the `How to authenticate with Google BigQuery <https://pandas-gbq.readthedocs.io/en/latest/howto/authentication.html>`__ guide for authentication instructions. Parameters...
[ "Load", "data", "from", "Google", "BigQuery", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/gbq.py#L24-L167
19,650
pandas-dev/pandas
pandas/plotting/_misc.py
andrews_curves
def andrews_curves(frame, class_column, ax=None, samples=200, color=None, colormap=None, **kwds): """ Generate a matplotlib plot of Andrews curves, for visualising clusters of multivariate data. Andrews curves have the functional form: f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t...
python
def andrews_curves(frame, class_column, ax=None, samples=200, color=None, colormap=None, **kwds): """ Generate a matplotlib plot of Andrews curves, for visualising clusters of multivariate data. Andrews curves have the functional form: f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t...
[ "def", "andrews_curves", "(", "frame", ",", "class_column", ",", "ax", "=", "None", ",", "samples", "=", "200", ",", "color", "=", "None", ",", "colormap", "=", "None", ",", "*", "*", "kwds", ")", ":", "from", "math", "import", "sqrt", ",", "pi", "...
Generate a matplotlib plot of Andrews curves, for visualising clusters of multivariate data. Andrews curves have the functional form: f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t) + x_4 sin(2t) + x_5 cos(2t) + ... Where x coefficients correspond to the values of each dimension and t is ...
[ "Generate", "a", "matplotlib", "plot", "of", "Andrews", "curves", "for", "visualising", "clusters", "of", "multivariate", "data", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_misc.py#L270-L356
19,651
pandas-dev/pandas
pandas/plotting/_misc.py
bootstrap_plot
def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds): """ Bootstrap plot on mean, median and mid-range statistics. The bootstrap plot is used to estimate the uncertainty of a statistic by relaying on random sampling with replacement [1]_. This function will generate bootstrapping plot...
python
def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds): """ Bootstrap plot on mean, median and mid-range statistics. The bootstrap plot is used to estimate the uncertainty of a statistic by relaying on random sampling with replacement [1]_. This function will generate bootstrapping plot...
[ "def", "bootstrap_plot", "(", "series", ",", "fig", "=", "None", ",", "size", "=", "50", ",", "samples", "=", "500", ",", "*", "*", "kwds", ")", ":", "import", "random", "import", "matplotlib", ".", "pyplot", "as", "plt", "# random.sample(ndarray, int) fai...
Bootstrap plot on mean, median and mid-range statistics. The bootstrap plot is used to estimate the uncertainty of a statistic by relaying on random sampling with replacement [1]_. This function will generate bootstrapping plots for mean, median and mid-range statistics for the given number of samples ...
[ "Bootstrap", "plot", "on", "mean", "median", "and", "mid", "-", "range", "statistics", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_misc.py#L359-L447
19,652
pandas-dev/pandas
pandas/plotting/_misc.py
autocorrelation_plot
def autocorrelation_plot(series, ax=None, **kwds): """ Autocorrelation plot for time series. Parameters: ----------- series: Time series ax: Matplotlib axis object, optional kwds : keywords Options to pass to matplotlib plotting method Returns: ----------- class:`matplo...
python
def autocorrelation_plot(series, ax=None, **kwds): """ Autocorrelation plot for time series. Parameters: ----------- series: Time series ax: Matplotlib axis object, optional kwds : keywords Options to pass to matplotlib plotting method Returns: ----------- class:`matplo...
[ "def", "autocorrelation_plot", "(", "series", ",", "ax", "=", "None", ",", "*", "*", "kwds", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "n", "=", "len", "(", "series", ")", "data", "=", "np", ".", "asarray", "(", "series", ")", "...
Autocorrelation plot for time series. Parameters: ----------- series: Time series ax: Matplotlib axis object, optional kwds : keywords Options to pass to matplotlib plotting method Returns: ----------- class:`matplotlib.axis.Axes`
[ "Autocorrelation", "plot", "for", "time", "series", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_misc.py#L596-L637
19,653
pandas-dev/pandas
pandas/core/computation/align.py
_any_pandas_objects
def _any_pandas_objects(terms): """Check a sequence of terms for instances of PandasObject.""" return any(isinstance(term.value, pd.core.generic.PandasObject) for term in terms)
python
def _any_pandas_objects(terms): """Check a sequence of terms for instances of PandasObject.""" return any(isinstance(term.value, pd.core.generic.PandasObject) for term in terms)
[ "def", "_any_pandas_objects", "(", "terms", ")", ":", "return", "any", "(", "isinstance", "(", "term", ".", "value", ",", "pd", ".", "core", ".", "generic", ".", "PandasObject", ")", "for", "term", "in", "terms", ")" ]
Check a sequence of terms for instances of PandasObject.
[ "Check", "a", "sequence", "of", "terms", "for", "instances", "of", "PandasObject", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/align.py#L36-L39
19,654
pandas-dev/pandas
pandas/core/computation/align.py
_align
def _align(terms): """Align a set of terms""" try: # flatten the parse tree (a nested list, really) terms = list(com.flatten(terms)) except TypeError: # can't iterate so it must just be a constant or single variable if isinstance(terms.value, pd.core.generic.NDFrame): ...
python
def _align(terms): """Align a set of terms""" try: # flatten the parse tree (a nested list, really) terms = list(com.flatten(terms)) except TypeError: # can't iterate so it must just be a constant or single variable if isinstance(terms.value, pd.core.generic.NDFrame): ...
[ "def", "_align", "(", "terms", ")", ":", "try", ":", "# flatten the parse tree (a nested list, really)", "terms", "=", "list", "(", "com", ".", "flatten", "(", "terms", ")", ")", "except", "TypeError", ":", "# can't iterate so it must just be a constant or single variab...
Align a set of terms
[ "Align", "a", "set", "of", "terms" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/align.py#L114-L132
19,655
pandas-dev/pandas
pandas/plotting/_timeseries.py
tsplot
def tsplot(series, plotf, ax=None, **kwargs): import warnings """ Plots a Series on the given Matplotlib axes or the current axes Parameters ---------- axes : Axes series : Series Notes _____ Supports same kwargs as Axes.plot .. deprecated:: 0.23.0 Use Series.plot(...
python
def tsplot(series, plotf, ax=None, **kwargs): import warnings """ Plots a Series on the given Matplotlib axes or the current axes Parameters ---------- axes : Axes series : Series Notes _____ Supports same kwargs as Axes.plot .. deprecated:: 0.23.0 Use Series.plot(...
[ "def", "tsplot", "(", "series", ",", "plotf", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "import", "warnings", "warnings", ".", "warn", "(", "\"'tsplot' is deprecated and will be removed in a \"", "\"future version. Please use Series.plot() instead.\"", ...
Plots a Series on the given Matplotlib axes or the current axes Parameters ---------- axes : Axes series : Series Notes _____ Supports same kwargs as Axes.plot .. deprecated:: 0.23.0 Use Series.plot() instead
[ "Plots", "a", "Series", "on", "the", "given", "Matplotlib", "axes", "or", "the", "current", "axes" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_timeseries.py#L26-L62
19,656
pandas-dev/pandas
pandas/plotting/_timeseries.py
_decorate_axes
def _decorate_axes(ax, freq, kwargs): """Initialize axes for time-series plotting""" if not hasattr(ax, '_plot_data'): ax._plot_data = [] ax.freq = freq xaxis = ax.get_xaxis() xaxis.freq = freq if not hasattr(ax, 'legendlabels'): ax.legendlabels = [kwargs.get('label', None)] ...
python
def _decorate_axes(ax, freq, kwargs): """Initialize axes for time-series plotting""" if not hasattr(ax, '_plot_data'): ax._plot_data = [] ax.freq = freq xaxis = ax.get_xaxis() xaxis.freq = freq if not hasattr(ax, 'legendlabels'): ax.legendlabels = [kwargs.get('label', None)] ...
[ "def", "_decorate_axes", "(", "ax", ",", "freq", ",", "kwargs", ")", ":", "if", "not", "hasattr", "(", "ax", ",", "'_plot_data'", ")", ":", "ax", ".", "_plot_data", "=", "[", "]", "ax", ".", "freq", "=", "freq", "xaxis", "=", "ax", ".", "get_xaxis"...
Initialize axes for time-series plotting
[ "Initialize", "axes", "for", "time", "-", "series", "plotting" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_timeseries.py#L157-L170
19,657
pandas-dev/pandas
pandas/core/frame.py
DataFrame._is_homogeneous_type
def _is_homogeneous_type(self): """ Whether all the columns in a DataFrame have the same type. Returns ------- bool Examples -------- >>> DataFrame({"A": [1, 2], "B": [3, 4]})._is_homogeneous_type True >>> DataFrame({"A": [1, 2], "B": [3....
python
def _is_homogeneous_type(self): """ Whether all the columns in a DataFrame have the same type. Returns ------- bool Examples -------- >>> DataFrame({"A": [1, 2], "B": [3, 4]})._is_homogeneous_type True >>> DataFrame({"A": [1, 2], "B": [3....
[ "def", "_is_homogeneous_type", "(", "self", ")", ":", "if", "self", ".", "_data", ".", "any_extension_types", ":", "return", "len", "(", "{", "block", ".", "dtype", "for", "block", "in", "self", ".", "_data", ".", "blocks", "}", ")", "==", "1", "else",...
Whether all the columns in a DataFrame have the same type. Returns ------- bool Examples -------- >>> DataFrame({"A": [1, 2], "B": [3, 4]})._is_homogeneous_type True >>> DataFrame({"A": [1, 2], "B": [3.0, 4.0]})._is_homogeneous_type False ...
[ "Whether", "all", "the", "columns", "in", "a", "DataFrame", "have", "the", "same", "type", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L514-L540
19,658
pandas-dev/pandas
pandas/core/frame.py
DataFrame._repr_html_
def _repr_html_(self): """ Return a html representation for a particular DataFrame. Mainly for IPython notebook. """ if self._info_repr(): buf = StringIO("") self.info(buf=buf) # need to escape the <class>, should be the first line. ...
python
def _repr_html_(self): """ Return a html representation for a particular DataFrame. Mainly for IPython notebook. """ if self._info_repr(): buf = StringIO("") self.info(buf=buf) # need to escape the <class>, should be the first line. ...
[ "def", "_repr_html_", "(", "self", ")", ":", "if", "self", ".", "_info_repr", "(", ")", ":", "buf", "=", "StringIO", "(", "\"\"", ")", "self", ".", "info", "(", "buf", "=", "buf", ")", "# need to escape the <class>, should be the first line.", "val", "=", ...
Return a html representation for a particular DataFrame. Mainly for IPython notebook.
[ "Return", "a", "html", "representation", "for", "a", "particular", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L635-L657
19,659
pandas-dev/pandas
pandas/core/frame.py
DataFrame.itertuples
def itertuples(self, index=True, name="Pandas"): """ Iterate over DataFrame rows as namedtuples. Parameters ---------- index : bool, default True If True, return the index as the first element of the tuple. name : str or None, default "Pandas" The...
python
def itertuples(self, index=True, name="Pandas"): """ Iterate over DataFrame rows as namedtuples. Parameters ---------- index : bool, default True If True, return the index as the first element of the tuple. name : str or None, default "Pandas" The...
[ "def", "itertuples", "(", "self", ",", "index", "=", "True", ",", "name", "=", "\"Pandas\"", ")", ":", "arrays", "=", "[", "]", "fields", "=", "list", "(", "self", ".", "columns", ")", "if", "index", ":", "arrays", ".", "append", "(", "self", ".", ...
Iterate over DataFrame rows as namedtuples. Parameters ---------- index : bool, default True If True, return the index as the first element of the tuple. name : str or None, default "Pandas" The name of the returned namedtuples or None to return regular ...
[ "Iterate", "over", "DataFrame", "rows", "as", "namedtuples", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L832-L910
19,660
pandas-dev/pandas
pandas/core/frame.py
DataFrame.dot
def dot(self, other): """ Compute the matrix mutiplication between the DataFrame and other. This method computes the matrix product between the DataFrame and the values of an other Series, DataFrame or a numpy array. It can also be called using ``self @ other`` in Python >= 3.5...
python
def dot(self, other): """ Compute the matrix mutiplication between the DataFrame and other. This method computes the matrix product between the DataFrame and the values of an other Series, DataFrame or a numpy array. It can also be called using ``self @ other`` in Python >= 3.5...
[ "def", "dot", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "(", "Series", ",", "DataFrame", ")", ")", ":", "common", "=", "self", ".", "columns", ".", "union", "(", "other", ".", "index", ")", "if", "(", "len", "(",...
Compute the matrix mutiplication between the DataFrame and other. This method computes the matrix product between the DataFrame and the values of an other Series, DataFrame or a numpy array. It can also be called using ``self @ other`` in Python >= 3.5. Parameters ---------- ...
[ "Compute", "the", "matrix", "mutiplication", "between", "the", "DataFrame", "and", "other", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L920-L1018
19,661
pandas-dev/pandas
pandas/core/frame.py
DataFrame.from_dict
def from_dict(cls, data, orient='columns', dtype=None, columns=None): """ Construct DataFrame from dict of array-like or dicts. Creates DataFrame object from dictionary by columns or by index allowing dtype specification. Parameters ---------- data : dict ...
python
def from_dict(cls, data, orient='columns', dtype=None, columns=None): """ Construct DataFrame from dict of array-like or dicts. Creates DataFrame object from dictionary by columns or by index allowing dtype specification. Parameters ---------- data : dict ...
[ "def", "from_dict", "(", "cls", ",", "data", ",", "orient", "=", "'columns'", ",", "dtype", "=", "None", ",", "columns", "=", "None", ")", ":", "index", "=", "None", "orient", "=", "orient", ".", "lower", "(", ")", "if", "orient", "==", "'index'", ...
Construct DataFrame from dict of array-like or dicts. Creates DataFrame object from dictionary by columns or by index allowing dtype specification. Parameters ---------- data : dict Of the form {field : array-like} or {field : dict}. orient : {'columns', 'in...
[ "Construct", "DataFrame", "from", "dict", "of", "array", "-", "like", "or", "dicts", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1036-L1115
19,662
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_numpy
def to_numpy(self, dtype=None, copy=False): """ Convert the DataFrame to a NumPy array. .. versionadded:: 0.24.0 By default, the dtype of the returned array will be the common NumPy dtype of all types in the DataFrame. For example, if the dtypes are ``float16`` and ``fl...
python
def to_numpy(self, dtype=None, copy=False): """ Convert the DataFrame to a NumPy array. .. versionadded:: 0.24.0 By default, the dtype of the returned array will be the common NumPy dtype of all types in the DataFrame. For example, if the dtypes are ``float16`` and ``fl...
[ "def", "to_numpy", "(", "self", ",", "dtype", "=", "None", ",", "copy", "=", "False", ")", ":", "result", "=", "np", ".", "array", "(", "self", ".", "values", ",", "dtype", "=", "dtype", ",", "copy", "=", "copy", ")", "return", "result" ]
Convert the DataFrame to a NumPy array. .. versionadded:: 0.24.0 By default, the dtype of the returned array will be the common NumPy dtype of all types in the DataFrame. For example, if the dtypes are ``float16`` and ``float32``, the results dtype will be ``float32``. This may...
[ "Convert", "the", "DataFrame", "to", "a", "NumPy", "array", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1117-L1170
19,663
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_dict
def to_dict(self, orient='dict', into=dict): """ Convert the DataFrame to a dictionary. The type of the key-value pairs can be customized with the parameters (see below). Parameters ---------- orient : str {'dict', 'list', 'series', 'split', 'records', 'index'} ...
python
def to_dict(self, orient='dict', into=dict): """ Convert the DataFrame to a dictionary. The type of the key-value pairs can be customized with the parameters (see below). Parameters ---------- orient : str {'dict', 'list', 'series', 'split', 'records', 'index'} ...
[ "def", "to_dict", "(", "self", ",", "orient", "=", "'dict'", ",", "into", "=", "dict", ")", ":", "if", "not", "self", ".", "columns", ".", "is_unique", ":", "warnings", ".", "warn", "(", "\"DataFrame columns are not unique, some \"", "\"columns will be omitted.\...
Convert the DataFrame to a dictionary. The type of the key-value pairs can be customized with the parameters (see below). Parameters ---------- orient : str {'dict', 'list', 'series', 'split', 'records', 'index'} Determines the type of the values of the dictionary. ...
[ "Convert", "the", "DataFrame", "to", "a", "dictionary", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1172-L1298
19,664
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_records
def to_records(self, index=True, convert_datetime64=None, column_dtypes=None, index_dtypes=None): """ Convert DataFrame to a NumPy record array. Index will be included as the first field of the record array if requested. Parameters ---------- ...
python
def to_records(self, index=True, convert_datetime64=None, column_dtypes=None, index_dtypes=None): """ Convert DataFrame to a NumPy record array. Index will be included as the first field of the record array if requested. Parameters ---------- ...
[ "def", "to_records", "(", "self", ",", "index", "=", "True", ",", "convert_datetime64", "=", "None", ",", "column_dtypes", "=", "None", ",", "index_dtypes", "=", "None", ")", ":", "if", "convert_datetime64", "is", "not", "None", ":", "warnings", ".", "warn...
Convert DataFrame to a NumPy record array. Index will be included as the first field of the record array if requested. Parameters ---------- index : bool, default True Include index in resulting record array, stored in 'index' field or using the index la...
[ "Convert", "DataFrame", "to", "a", "NumPy", "record", "array", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1535-L1717
19,665
pandas-dev/pandas
pandas/core/frame.py
DataFrame.from_items
def from_items(cls, items, columns=None, orient='columns'): """ Construct a DataFrame from a list of tuples. .. deprecated:: 0.23.0 `from_items` is deprecated and will be removed in a future version. Use :meth:`DataFrame.from_dict(dict(items)) <DataFrame.from_dict>` ...
python
def from_items(cls, items, columns=None, orient='columns'): """ Construct a DataFrame from a list of tuples. .. deprecated:: 0.23.0 `from_items` is deprecated and will be removed in a future version. Use :meth:`DataFrame.from_dict(dict(items)) <DataFrame.from_dict>` ...
[ "def", "from_items", "(", "cls", ",", "items", ",", "columns", "=", "None", ",", "orient", "=", "'columns'", ")", ":", "warnings", ".", "warn", "(", "\"from_items is deprecated. Please use \"", "\"DataFrame.from_dict(dict(items), ...) instead. \"", "\"DataFrame.from_dict(...
Construct a DataFrame from a list of tuples. .. deprecated:: 0.23.0 `from_items` is deprecated and will be removed in a future version. Use :meth:`DataFrame.from_dict(dict(items)) <DataFrame.from_dict>` instead. :meth:`DataFrame.from_dict(OrderedDict(items)) <DataFrame.f...
[ "Construct", "a", "DataFrame", "from", "a", "list", "of", "tuples", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1720-L1805
19,666
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_sparse
def to_sparse(self, fill_value=None, kind='block'): """ Convert to SparseDataFrame. Implement the sparse version of the DataFrame meaning that any data matching a specific value it's omitted in the representation. The sparse DataFrame allows for a more efficient storage. ...
python
def to_sparse(self, fill_value=None, kind='block'): """ Convert to SparseDataFrame. Implement the sparse version of the DataFrame meaning that any data matching a specific value it's omitted in the representation. The sparse DataFrame allows for a more efficient storage. ...
[ "def", "to_sparse", "(", "self", ",", "fill_value", "=", "None", ",", "kind", "=", "'block'", ")", ":", "from", "pandas", ".", "core", ".", "sparse", ".", "api", "import", "SparseDataFrame", "return", "SparseDataFrame", "(", "self", ".", "_series", ",", ...
Convert to SparseDataFrame. Implement the sparse version of the DataFrame meaning that any data matching a specific value it's omitted in the representation. The sparse DataFrame allows for a more efficient storage. Parameters ---------- fill_value : float, default None...
[ "Convert", "to", "SparseDataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1879-L1936
19,667
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_stata
def to_stata(self, fname, convert_dates=None, write_index=True, encoding="latin-1", byteorder=None, time_stamp=None, data_label=None, variable_labels=None, version=114, convert_strl=None): """ Export DataFrame object to Stata dta format. Writes...
python
def to_stata(self, fname, convert_dates=None, write_index=True, encoding="latin-1", byteorder=None, time_stamp=None, data_label=None, variable_labels=None, version=114, convert_strl=None): """ Export DataFrame object to Stata dta format. Writes...
[ "def", "to_stata", "(", "self", ",", "fname", ",", "convert_dates", "=", "None", ",", "write_index", "=", "True", ",", "encoding", "=", "\"latin-1\"", ",", "byteorder", "=", "None", ",", "time_stamp", "=", "None", ",", "data_label", "=", "None", ",", "va...
Export DataFrame object to Stata dta format. Writes the DataFrame to a Stata dataset file. "dta" files contain a Stata dataset. Parameters ---------- fname : str, buffer or path object String, path object (pathlib.Path or py._path.local.LocalPath) or obj...
[ "Export", "DataFrame", "object", "to", "Stata", "dta", "format", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1955-L2055
19,668
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_feather
def to_feather(self, fname): """ Write out the binary feather-format for DataFrames. .. versionadded:: 0.20.0 Parameters ---------- fname : str string file path """ from pandas.io.feather_format import to_feather to_feather(self, fnam...
python
def to_feather(self, fname): """ Write out the binary feather-format for DataFrames. .. versionadded:: 0.20.0 Parameters ---------- fname : str string file path """ from pandas.io.feather_format import to_feather to_feather(self, fnam...
[ "def", "to_feather", "(", "self", ",", "fname", ")", ":", "from", "pandas", ".", "io", ".", "feather_format", "import", "to_feather", "to_feather", "(", "self", ",", "fname", ")" ]
Write out the binary feather-format for DataFrames. .. versionadded:: 0.20.0 Parameters ---------- fname : str string file path
[ "Write", "out", "the", "binary", "feather", "-", "format", "for", "DataFrames", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2057-L2069
19,669
pandas-dev/pandas
pandas/core/frame.py
DataFrame.to_parquet
def to_parquet(self, fname, engine='auto', compression='snappy', index=None, partition_cols=None, **kwargs): """ Write a DataFrame to the binary parquet format. .. versionadded:: 0.21.0 This function writes the dataframe as a `parquet file <https://parquet.ap...
python
def to_parquet(self, fname, engine='auto', compression='snappy', index=None, partition_cols=None, **kwargs): """ Write a DataFrame to the binary parquet format. .. versionadded:: 0.21.0 This function writes the dataframe as a `parquet file <https://parquet.ap...
[ "def", "to_parquet", "(", "self", ",", "fname", ",", "engine", "=", "'auto'", ",", "compression", "=", "'snappy'", ",", "index", "=", "None", ",", "partition_cols", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "pandas", ".", "io", ".", "pa...
Write a DataFrame to the binary parquet format. .. versionadded:: 0.21.0 This function writes the dataframe as a `parquet file <https://parquet.apache.org/>`_. You can choose different parquet backends, and have the option of compression. See :ref:`the user guide <io.parquet>` ...
[ "Write", "a", "DataFrame", "to", "the", "binary", "parquet", "format", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2071-L2141
19,670
pandas-dev/pandas
pandas/core/frame.py
DataFrame.memory_usage
def memory_usage(self, index=True, deep=False): """ Return the memory usage of each column in bytes. The memory usage can optionally include the contribution of the index and elements of `object` dtype. This value is displayed in `DataFrame.info` by default. This can be ...
python
def memory_usage(self, index=True, deep=False): """ Return the memory usage of each column in bytes. The memory usage can optionally include the contribution of the index and elements of `object` dtype. This value is displayed in `DataFrame.info` by default. This can be ...
[ "def", "memory_usage", "(", "self", ",", "index", "=", "True", ",", "deep", "=", "False", ")", ":", "result", "=", "Series", "(", "[", "c", ".", "memory_usage", "(", "index", "=", "False", ",", "deep", "=", "deep", ")", "for", "col", ",", "c", "i...
Return the memory usage of each column in bytes. The memory usage can optionally include the contribution of the index and elements of `object` dtype. This value is displayed in `DataFrame.info` by default. This can be suppressed by setting ``pandas.options.display.memory_usage`` to Fa...
[ "Return", "the", "memory", "usage", "of", "each", "column", "in", "bytes", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2453-L2542
19,671
pandas-dev/pandas
pandas/core/frame.py
DataFrame.transpose
def transpose(self, *args, **kwargs): """ Transpose index and columns. Reflect the DataFrame over its main diagonal by writing rows as columns and vice-versa. The property :attr:`.T` is an accessor to the method :meth:`transpose`. Parameters ---------- c...
python
def transpose(self, *args, **kwargs): """ Transpose index and columns. Reflect the DataFrame over its main diagonal by writing rows as columns and vice-versa. The property :attr:`.T` is an accessor to the method :meth:`transpose`. Parameters ---------- c...
[ "def", "transpose", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_transpose", "(", "args", ",", "dict", "(", ")", ")", "return", "super", "(", ")", ".", "transpose", "(", "1", ",", "0", ",", "*", "*", "k...
Transpose index and columns. Reflect the DataFrame over its main diagonal by writing rows as columns and vice-versa. The property :attr:`.T` is an accessor to the method :meth:`transpose`. Parameters ---------- copy : bool, default False If True, the underly...
[ "Transpose", "index", "and", "columns", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2544-L2640
19,672
pandas-dev/pandas
pandas/core/frame.py
DataFrame.get_value
def get_value(self, index, col, takeable=False): """ Quickly retrieve single value at passed column and index. .. deprecated:: 0.21.0 Use .at[] or .iat[] accessors instead. Parameters ---------- index : row label col : column label takeable :...
python
def get_value(self, index, col, takeable=False): """ Quickly retrieve single value at passed column and index. .. deprecated:: 0.21.0 Use .at[] or .iat[] accessors instead. Parameters ---------- index : row label col : column label takeable :...
[ "def", "get_value", "(", "self", ",", "index", ",", "col", ",", "takeable", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"get_value is deprecated and will be removed \"", "\"in a future release. Please use \"", "\".at[] or .iat[] accessors instead\"", ",", "Fut...
Quickly retrieve single value at passed column and index. .. deprecated:: 0.21.0 Use .at[] or .iat[] accessors instead. Parameters ---------- index : row label col : column label takeable : interpret the index/col as indexers, default False Returns ...
[ "Quickly", "retrieve", "single", "value", "at", "passed", "column", "and", "index", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2679-L2701
19,673
pandas-dev/pandas
pandas/core/frame.py
DataFrame.set_value
def set_value(self, index, col, value, takeable=False): """ Put single value at passed column and index. .. deprecated:: 0.21.0 Use .at[] or .iat[] accessors instead. Parameters ---------- index : row label col : column label value : scalar ...
python
def set_value(self, index, col, value, takeable=False): """ Put single value at passed column and index. .. deprecated:: 0.21.0 Use .at[] or .iat[] accessors instead. Parameters ---------- index : row label col : column label value : scalar ...
[ "def", "set_value", "(", "self", ",", "index", ",", "col", ",", "value", ",", "takeable", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"set_value is deprecated and will be removed \"", "\"in a future release. Please use \"", "\".at[] or .iat[] accessors instead...
Put single value at passed column and index. .. deprecated:: 0.21.0 Use .at[] or .iat[] accessors instead. Parameters ---------- index : row label col : column label value : scalar takeable : interpret the index/col as indexers, default False ...
[ "Put", "single", "value", "at", "passed", "column", "and", "index", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2723-L2747
19,674
pandas-dev/pandas
pandas/core/frame.py
DataFrame.query
def query(self, expr, inplace=False, **kwargs): """ Query the columns of a DataFrame with a boolean expression. Parameters ---------- expr : str The query string to evaluate. You can refer to variables in the environment by prefixing them with an '@' cha...
python
def query(self, expr, inplace=False, **kwargs): """ Query the columns of a DataFrame with a boolean expression. Parameters ---------- expr : str The query string to evaluate. You can refer to variables in the environment by prefixing them with an '@' cha...
[ "def", "query", "(", "self", ",", "expr", ",", "inplace", "=", "False", ",", "*", "*", "kwargs", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "if", "not", "isinstance", "(", "expr", ",", "str", ")", ":", "ms...
Query the columns of a DataFrame with a boolean expression. Parameters ---------- expr : str The query string to evaluate. You can refer to variables in the environment by prefixing them with an '@' character like ``@a + b``. .. versionadded:: 0...
[ "Query", "the", "columns", "of", "a", "DataFrame", "with", "a", "boolean", "expression", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L2955-L3082
19,675
pandas-dev/pandas
pandas/core/frame.py
DataFrame.eval
def eval(self, expr, inplace=False, **kwargs): """ Evaluate a string describing operations on DataFrame columns. Operates on columns only, not specific rows or elements. This allows `eval` to run arbitrary code, which can make you vulnerable to code injection if you pass user i...
python
def eval(self, expr, inplace=False, **kwargs): """ Evaluate a string describing operations on DataFrame columns. Operates on columns only, not specific rows or elements. This allows `eval` to run arbitrary code, which can make you vulnerable to code injection if you pass user i...
[ "def", "eval", "(", "self", ",", "expr", ",", "inplace", "=", "False", ",", "*", "*", "kwargs", ")", ":", "from", "pandas", ".", "core", ".", "computation", ".", "eval", "import", "eval", "as", "_eval", "inplace", "=", "validate_bool_kwarg", "(", "inpl...
Evaluate a string describing operations on DataFrame columns. Operates on columns only, not specific rows or elements. This allows `eval` to run arbitrary code, which can make you vulnerable to code injection if you pass user input to this function. Parameters ---------- ...
[ "Evaluate", "a", "string", "describing", "operations", "on", "DataFrame", "columns", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3084-L3187
19,676
pandas-dev/pandas
pandas/core/frame.py
DataFrame.select_dtypes
def select_dtypes(self, include=None, exclude=None): """ Return a subset of the DataFrame's columns based on the column dtypes. Parameters ---------- include, exclude : scalar or list-like A selection of dtypes or strings to be included/excluded. At least ...
python
def select_dtypes(self, include=None, exclude=None): """ Return a subset of the DataFrame's columns based on the column dtypes. Parameters ---------- include, exclude : scalar or list-like A selection of dtypes or strings to be included/excluded. At least ...
[ "def", "select_dtypes", "(", "self", ",", "include", "=", "None", ",", "exclude", "=", "None", ")", ":", "def", "_get_info_slice", "(", "obj", ",", "indexer", ")", ":", "\"\"\"Slice the info axis of `obj` with `indexer`.\"\"\"", "if", "not", "hasattr", "(", "obj...
Return a subset of the DataFrame's columns based on the column dtypes. Parameters ---------- include, exclude : scalar or list-like A selection of dtypes or strings to be included/excluded. At least one of these parameters must be supplied. Returns -----...
[ "Return", "a", "subset", "of", "the", "DataFrame", "s", "columns", "based", "on", "the", "column", "dtypes", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3189-L3324
19,677
pandas-dev/pandas
pandas/core/frame.py
DataFrame._box_col_values
def _box_col_values(self, values, items): """ Provide boxed values for a column. """ klass = self._constructor_sliced return klass(values, index=self.index, name=items, fastpath=True)
python
def _box_col_values(self, values, items): """ Provide boxed values for a column. """ klass = self._constructor_sliced return klass(values, index=self.index, name=items, fastpath=True)
[ "def", "_box_col_values", "(", "self", ",", "values", ",", "items", ")", ":", "klass", "=", "self", ".", "_constructor_sliced", "return", "klass", "(", "values", ",", "index", "=", "self", ".", "index", ",", "name", "=", "items", ",", "fastpath", "=", ...
Provide boxed values for a column.
[ "Provide", "boxed", "values", "for", "a", "column", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3333-L3338
19,678
pandas-dev/pandas
pandas/core/frame.py
DataFrame._ensure_valid_index
def _ensure_valid_index(self, value): """ Ensure that if we don't have an index, that we can create one from the passed value. """ # GH5632, make sure that we are a Series convertible if not len(self.index) and is_list_like(value): try: value =...
python
def _ensure_valid_index(self, value): """ Ensure that if we don't have an index, that we can create one from the passed value. """ # GH5632, make sure that we are a Series convertible if not len(self.index) and is_list_like(value): try: value =...
[ "def", "_ensure_valid_index", "(", "self", ",", "value", ")", ":", "# GH5632, make sure that we are a Series convertible", "if", "not", "len", "(", "self", ".", "index", ")", "and", "is_list_like", "(", "value", ")", ":", "try", ":", "value", "=", "Series", "(...
Ensure that if we don't have an index, that we can create one from the passed value.
[ "Ensure", "that", "if", "we", "don", "t", "have", "an", "index", "that", "we", "can", "create", "one", "from", "the", "passed", "value", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3400-L3415
19,679
pandas-dev/pandas
pandas/core/frame.py
DataFrame._set_item
def _set_item(self, key, value): """ Add series to DataFrame in specified column. If series is a numpy-array (not a Series/TimeSeries), it must be the same length as the DataFrames index or an error will be thrown. Series/TimeSeries will be conformed to the DataFrames index to ...
python
def _set_item(self, key, value): """ Add series to DataFrame in specified column. If series is a numpy-array (not a Series/TimeSeries), it must be the same length as the DataFrames index or an error will be thrown. Series/TimeSeries will be conformed to the DataFrames index to ...
[ "def", "_set_item", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "_ensure_valid_index", "(", "value", ")", "value", "=", "self", ".", "_sanitize_column", "(", "key", ",", "value", ")", "NDFrame", ".", "_set_item", "(", "self", ",", "ke...
Add series to DataFrame in specified column. If series is a numpy-array (not a Series/TimeSeries), it must be the same length as the DataFrames index or an error will be thrown. Series/TimeSeries will be conformed to the DataFrames index to ensure homogeneity.
[ "Add", "series", "to", "DataFrame", "in", "specified", "column", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3417-L3436
19,680
pandas-dev/pandas
pandas/core/frame.py
DataFrame.insert
def insert(self, loc, column, value, allow_duplicates=False): """ Insert column into DataFrame at specified location. Raises a ValueError if `column` is already contained in the DataFrame, unless `allow_duplicates` is set to True. Parameters ---------- loc : int...
python
def insert(self, loc, column, value, allow_duplicates=False): """ Insert column into DataFrame at specified location. Raises a ValueError if `column` is already contained in the DataFrame, unless `allow_duplicates` is set to True. Parameters ---------- loc : int...
[ "def", "insert", "(", "self", ",", "loc", ",", "column", ",", "value", ",", "allow_duplicates", "=", "False", ")", ":", "self", ".", "_ensure_valid_index", "(", "value", ")", "value", "=", "self", ".", "_sanitize_column", "(", "column", ",", "value", ","...
Insert column into DataFrame at specified location. Raises a ValueError if `column` is already contained in the DataFrame, unless `allow_duplicates` is set to True. Parameters ---------- loc : int Insertion index. Must verify 0 <= loc <= len(columns) column ...
[ "Insert", "column", "into", "DataFrame", "at", "specified", "location", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3438-L3457
19,681
pandas-dev/pandas
pandas/core/frame.py
DataFrame.assign
def assign(self, **kwargs): r""" Assign new columns to a DataFrame. Returns a new object with all original columns in addition to new ones. Existing columns that are re-assigned will be overwritten. Parameters ---------- **kwargs : dict of {str: callable or Seri...
python
def assign(self, **kwargs): r""" Assign new columns to a DataFrame. Returns a new object with all original columns in addition to new ones. Existing columns that are re-assigned will be overwritten. Parameters ---------- **kwargs : dict of {str: callable or Seri...
[ "def", "assign", "(", "self", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "copy", "(", ")", "# >= 3.6 preserve order of kwargs", "if", "PY36", ":", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "data", "[", "k"...
r""" Assign new columns to a DataFrame. Returns a new object with all original columns in addition to new ones. Existing columns that are re-assigned will be overwritten. Parameters ---------- **kwargs : dict of {str: callable or Series} The column names are...
[ "r", "Assign", "new", "columns", "to", "a", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3459-L3547
19,682
pandas-dev/pandas
pandas/core/frame.py
DataFrame.lookup
def lookup(self, row_labels, col_labels): """ Label-based "fancy indexing" function for DataFrame. Given equal-length arrays of row and column labels, return an array of the values corresponding to each (row, col) pair. Parameters ---------- row_labels : sequenc...
python
def lookup(self, row_labels, col_labels): """ Label-based "fancy indexing" function for DataFrame. Given equal-length arrays of row and column labels, return an array of the values corresponding to each (row, col) pair. Parameters ---------- row_labels : sequenc...
[ "def", "lookup", "(", "self", ",", "row_labels", ",", "col_labels", ")", ":", "n", "=", "len", "(", "row_labels", ")", "if", "n", "!=", "len", "(", "col_labels", ")", ":", "raise", "ValueError", "(", "'Row labels must have same size as column labels'", ")", ...
Label-based "fancy indexing" function for DataFrame. Given equal-length arrays of row and column labels, return an array of the values corresponding to each (row, col) pair. Parameters ---------- row_labels : sequence The row labels to use for lookup col_lab...
[ "Label", "-", "based", "fancy", "indexing", "function", "for", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3659-L3708
19,683
pandas-dev/pandas
pandas/core/frame.py
DataFrame._reindex_multi
def _reindex_multi(self, axes, copy, fill_value): """ We are guaranteed non-Nones in the axes. """ new_index, row_indexer = self.index.reindex(axes['index']) new_columns, col_indexer = self.columns.reindex(axes['columns']) if row_indexer is not None and col_indexer is n...
python
def _reindex_multi(self, axes, copy, fill_value): """ We are guaranteed non-Nones in the axes. """ new_index, row_indexer = self.index.reindex(axes['index']) new_columns, col_indexer = self.columns.reindex(axes['columns']) if row_indexer is not None and col_indexer is n...
[ "def", "_reindex_multi", "(", "self", ",", "axes", ",", "copy", ",", "fill_value", ")", ":", "new_index", ",", "row_indexer", "=", "self", ".", "index", ".", "reindex", "(", "axes", "[", "'index'", "]", ")", "new_columns", ",", "col_indexer", "=", "self"...
We are guaranteed non-Nones in the axes.
[ "We", "are", "guaranteed", "non", "-", "Nones", "in", "the", "axes", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3747-L3765
19,684
pandas-dev/pandas
pandas/core/frame.py
DataFrame.drop
def drop(self, labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise'): """ Drop specified labels from rows or columns. Remove rows or columns by specifying label names and corresponding axis, or by specifying directly index or column names...
python
def drop(self, labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise'): """ Drop specified labels from rows or columns. Remove rows or columns by specifying label names and corresponding axis, or by specifying directly index or column names...
[ "def", "drop", "(", "self", ",", "labels", "=", "None", ",", "axis", "=", "0", ",", "index", "=", "None", ",", "columns", "=", "None", ",", "level", "=", "None", ",", "inplace", "=", "False", ",", "errors", "=", "'raise'", ")", ":", "return", "su...
Drop specified labels from rows or columns. Remove rows or columns by specifying label names and corresponding axis, or by specifying directly index or column names. When using a multi-index, labels on different levels can be removed by specifying the level. Parameters ...
[ "Drop", "specified", "labels", "from", "rows", "or", "columns", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3800-L3926
19,685
pandas-dev/pandas
pandas/core/frame.py
DataFrame.rename
def rename(self, *args, **kwargs): """ Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. See the :ref:`user guide <basics.rename>` for more. P...
python
def rename(self, *args, **kwargs): """ Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. See the :ref:`user guide <basics.rename>` for more. P...
[ "def", "rename", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "axes", "=", "validate_axis_style_args", "(", "self", ",", "args", ",", "kwargs", ",", "'mapper'", ",", "'rename'", ")", "kwargs", ".", "update", "(", "axes", ")", "# ...
Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. See the :ref:`user guide <basics.rename>` for more. Parameters ---------- mapper : dict-like...
[ "Alter", "axes", "labels", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L3932-L4035
19,686
pandas-dev/pandas
pandas/core/frame.py
DataFrame.dropna
def dropna(self, axis=0, how='any', thresh=None, subset=None, inplace=False): """ Remove missing values. See the :ref:`User Guide <missing_data>` for more on which values are considered missing, and how to work with missing data. Parameters ---------- ...
python
def dropna(self, axis=0, how='any', thresh=None, subset=None, inplace=False): """ Remove missing values. See the :ref:`User Guide <missing_data>` for more on which values are considered missing, and how to work with missing data. Parameters ---------- ...
[ "def", "dropna", "(", "self", ",", "axis", "=", "0", ",", "how", "=", "'any'", ",", "thresh", "=", "None", ",", "subset", "=", "None", ",", "inplace", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")...
Remove missing values. See the :ref:`User Guide <missing_data>` for more on which values are considered missing, and how to work with missing data. Parameters ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 Determine if rows or columns which contain miss...
[ "Remove", "missing", "values", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L4497-L4644
19,687
pandas-dev/pandas
pandas/core/frame.py
DataFrame.drop_duplicates
def drop_duplicates(self, subset=None, keep='first', inplace=False): """ Return DataFrame with duplicate rows removed, optionally only considering certain columns. Indexes, including time indexes are ignored. Parameters ---------- subset : column label or sequenc...
python
def drop_duplicates(self, subset=None, keep='first', inplace=False): """ Return DataFrame with duplicate rows removed, optionally only considering certain columns. Indexes, including time indexes are ignored. Parameters ---------- subset : column label or sequenc...
[ "def", "drop_duplicates", "(", "self", ",", "subset", "=", "None", ",", "keep", "=", "'first'", ",", "inplace", "=", "False", ")", ":", "if", "self", ".", "empty", ":", "return", "self", ".", "copy", "(", ")", "inplace", "=", "validate_bool_kwarg", "("...
Return DataFrame with duplicate rows removed, optionally only considering certain columns. Indexes, including time indexes are ignored. Parameters ---------- subset : column label or sequence of labels, optional Only consider certain columns for identifying duplicate...
[ "Return", "DataFrame", "with", "duplicate", "rows", "removed", "optionally", "only", "considering", "certain", "columns", ".", "Indexes", "including", "time", "indexes", "are", "ignored", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L4646-L4679
19,688
pandas-dev/pandas
pandas/core/frame.py
DataFrame.duplicated
def duplicated(self, subset=None, keep='first'): """ Return boolean Series denoting duplicate rows, optionally only considering certain columns. Parameters ---------- subset : column label or sequence of labels, optional Only consider certain columns for iden...
python
def duplicated(self, subset=None, keep='first'): """ Return boolean Series denoting duplicate rows, optionally only considering certain columns. Parameters ---------- subset : column label or sequence of labels, optional Only consider certain columns for iden...
[ "def", "duplicated", "(", "self", ",", "subset", "=", "None", ",", "keep", "=", "'first'", ")", ":", "from", "pandas", ".", "core", ".", "sorting", "import", "get_group_index", "from", "pandas", ".", "_libs", ".", "hashtable", "import", "duplicated_int64", ...
Return boolean Series denoting duplicate rows, optionally only considering certain columns. Parameters ---------- subset : column label or sequence of labels, optional Only consider certain columns for identifying duplicates, by default use all of the columns ...
[ "Return", "boolean", "Series", "denoting", "duplicate", "rows", "optionally", "only", "considering", "certain", "columns", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L4681-L4732
19,689
pandas-dev/pandas
pandas/core/frame.py
DataFrame.nlargest
def nlargest(self, n, columns, keep='first'): """ Return the first `n` rows ordered by `columns` in descending order. Return the first `n` rows with the largest values in `columns`, in descending order. The columns that are not specified are returned as well, but not used for or...
python
def nlargest(self, n, columns, keep='first'): """ Return the first `n` rows ordered by `columns` in descending order. Return the first `n` rows with the largest values in `columns`, in descending order. The columns that are not specified are returned as well, but not used for or...
[ "def", "nlargest", "(", "self", ",", "n", ",", "columns", ",", "keep", "=", "'first'", ")", ":", "return", "algorithms", ".", "SelectNFrame", "(", "self", ",", "n", "=", "n", ",", "keep", "=", "keep", ",", "columns", "=", "columns", ")", ".", "nlar...
Return the first `n` rows ordered by `columns` in descending order. Return the first `n` rows with the largest values in `columns`, in descending order. The columns that are not specified are returned as well, but not used for ordering. This method is equivalent to ``df.sort_va...
[ "Return", "the", "first", "n", "rows", "ordered", "by", "columns", "in", "descending", "order", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L4843-L4953
19,690
pandas-dev/pandas
pandas/core/frame.py
DataFrame.nsmallest
def nsmallest(self, n, columns, keep='first'): """ Return the first `n` rows ordered by `columns` in ascending order. Return the first `n` rows with the smallest values in `columns`, in ascending order. The columns that are not specified are returned as well, but not used for or...
python
def nsmallest(self, n, columns, keep='first'): """ Return the first `n` rows ordered by `columns` in ascending order. Return the first `n` rows with the smallest values in `columns`, in ascending order. The columns that are not specified are returned as well, but not used for or...
[ "def", "nsmallest", "(", "self", ",", "n", ",", "columns", ",", "keep", "=", "'first'", ")", ":", "return", "algorithms", ".", "SelectNFrame", "(", "self", ",", "n", "=", "n", ",", "keep", "=", "keep", ",", "columns", "=", "columns", ")", ".", "nsm...
Return the first `n` rows ordered by `columns` in ascending order. Return the first `n` rows with the smallest values in `columns`, in ascending order. The columns that are not specified are returned as well, but not used for ordering. This method is equivalent to ``df.sort_val...
[ "Return", "the", "first", "n", "rows", "ordered", "by", "columns", "in", "ascending", "order", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L4955-L5055
19,691
pandas-dev/pandas
pandas/core/frame.py
DataFrame.swaplevel
def swaplevel(self, i=-2, j=-1, axis=0): """ Swap levels i and j in a MultiIndex on a particular axis. Parameters ---------- i, j : int, string (can be mixed) Level of index to be swapped. Can pass level name as string. Returns ------- DataFr...
python
def swaplevel(self, i=-2, j=-1, axis=0): """ Swap levels i and j in a MultiIndex on a particular axis. Parameters ---------- i, j : int, string (can be mixed) Level of index to be swapped. Can pass level name as string. Returns ------- DataFr...
[ "def", "swaplevel", "(", "self", ",", "i", "=", "-", "2", ",", "j", "=", "-", "1", ",", "axis", "=", "0", ")", ":", "result", "=", "self", ".", "copy", "(", ")", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "if", "axis", "=...
Swap levels i and j in a MultiIndex on a particular axis. Parameters ---------- i, j : int, string (can be mixed) Level of index to be swapped. Can pass level name as string. Returns ------- DataFrame .. versionchanged:: 0.18.1 The index...
[ "Swap", "levels", "i", "and", "j", "in", "a", "MultiIndex", "on", "a", "particular", "axis", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L5057-L5082
19,692
pandas-dev/pandas
pandas/core/frame.py
DataFrame.reorder_levels
def reorder_levels(self, order, axis=0): """ Rearrange index levels using input order. May not drop or duplicate levels. Parameters ---------- order : list of int or list of str List representing new level order. Reference level by number (positio...
python
def reorder_levels(self, order, axis=0): """ Rearrange index levels using input order. May not drop or duplicate levels. Parameters ---------- order : list of int or list of str List representing new level order. Reference level by number (positio...
[ "def", "reorder_levels", "(", "self", ",", "order", ",", "axis", "=", "0", ")", ":", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "if", "not", "isinstance", "(", "self", ".", "_get_axis", "(", "axis", ")", ",", "MultiIndex", ")", "...
Rearrange index levels using input order. May not drop or duplicate levels. Parameters ---------- order : list of int or list of str List representing new level order. Reference level by number (position) or by key (label). axis : int Where to...
[ "Rearrange", "index", "levels", "using", "input", "order", ".", "May", "not", "drop", "or", "duplicate", "levels", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L5084-L5112
19,693
pandas-dev/pandas
pandas/core/frame.py
DataFrame.combine
def combine(self, other, func, fill_value=None, overwrite=True): """ Perform column-wise combine with another DataFrame. Combines a DataFrame with `other` DataFrame using `func` to element-wise combine columns. The row and column indexes of the resulting DataFrame will be the un...
python
def combine(self, other, func, fill_value=None, overwrite=True): """ Perform column-wise combine with another DataFrame. Combines a DataFrame with `other` DataFrame using `func` to element-wise combine columns. The row and column indexes of the resulting DataFrame will be the un...
[ "def", "combine", "(", "self", ",", "other", ",", "func", ",", "fill_value", "=", "None", ",", "overwrite", "=", "True", ")", ":", "other_idxlen", "=", "len", "(", "other", ".", "index", ")", "# save for compare", "this", ",", "other", "=", "self", "."...
Perform column-wise combine with another DataFrame. Combines a DataFrame with `other` DataFrame using `func` to element-wise combine columns. The row and column indexes of the resulting DataFrame will be the union of the two. Parameters ---------- other : DataFrame ...
[ "Perform", "column", "-", "wise", "combine", "with", "another", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L5164-L5330
19,694
pandas-dev/pandas
pandas/core/frame.py
DataFrame.combine_first
def combine_first(self, other): """ Update null elements with value in the same location in `other`. Combine two DataFrame objects by filling null values in one DataFrame with non-null values from other DataFrame. The row and column indexes of the resulting DataFrame will be the...
python
def combine_first(self, other): """ Update null elements with value in the same location in `other`. Combine two DataFrame objects by filling null values in one DataFrame with non-null values from other DataFrame. The row and column indexes of the resulting DataFrame will be the...
[ "def", "combine_first", "(", "self", ",", "other", ")", ":", "import", "pandas", ".", "core", ".", "computation", ".", "expressions", "as", "expressions", "def", "extract_values", "(", "arr", ")", ":", "# Does two things:", "# 1. maybe gets the values from the Serie...
Update null elements with value in the same location in `other`. Combine two DataFrame objects by filling null values in one DataFrame with non-null values from other DataFrame. The row and column indexes of the resulting DataFrame will be the union of the two. Parameters -----...
[ "Update", "null", "elements", "with", "value", "in", "the", "same", "location", "in", "other", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L5332-L5406
19,695
pandas-dev/pandas
pandas/core/frame.py
DataFrame.update
def update(self, other, join='left', overwrite=True, filter_func=None, errors='ignore'): """ Modify in place using non-NA values from another DataFrame. Aligns on indices. There is no return value. Parameters ---------- other : DataFrame, or object coerci...
python
def update(self, other, join='left', overwrite=True, filter_func=None, errors='ignore'): """ Modify in place using non-NA values from another DataFrame. Aligns on indices. There is no return value. Parameters ---------- other : DataFrame, or object coerci...
[ "def", "update", "(", "self", ",", "other", ",", "join", "=", "'left'", ",", "overwrite", "=", "True", ",", "filter_func", "=", "None", ",", "errors", "=", "'ignore'", ")", ":", "import", "pandas", ".", "core", ".", "computation", ".", "expressions", "...
Modify in place using non-NA values from another DataFrame. Aligns on indices. There is no return value. Parameters ---------- other : DataFrame, or object coercible into a DataFrame Should have at least one matching index/column label with the original DataFram...
[ "Modify", "in", "place", "using", "non", "-", "NA", "values", "from", "another", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L5410-L5558
19,696
pandas-dev/pandas
pandas/core/frame.py
DataFrame.apply
def apply(self, func, axis=0, broadcast=None, raw=False, reduce=None, result_type=None, args=(), **kwds): """ Apply a function along an axis of the DataFrame. Objects passed to the function are Series objects whose index is either the DataFrame's index (``axis=0``) or the ...
python
def apply(self, func, axis=0, broadcast=None, raw=False, reduce=None, result_type=None, args=(), **kwds): """ Apply a function along an axis of the DataFrame. Objects passed to the function are Series objects whose index is either the DataFrame's index (``axis=0``) or the ...
[ "def", "apply", "(", "self", ",", "func", ",", "axis", "=", "0", ",", "broadcast", "=", "None", ",", "raw", "=", "False", ",", "reduce", "=", "None", ",", "result_type", "=", "None", ",", "args", "=", "(", ")", ",", "*", "*", "kwds", ")", ":", ...
Apply a function along an axis of the DataFrame. Objects passed to the function are Series objects whose index is either the DataFrame's index (``axis=0``) or the DataFrame's columns (``axis=1``). By default (``result_type=None``), the final return type is inferred from the return type ...
[ "Apply", "a", "function", "along", "an", "axis", "of", "the", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L6355-L6534
19,697
pandas-dev/pandas
pandas/core/frame.py
DataFrame.applymap
def applymap(self, func): """ Apply a function to a Dataframe elementwise. This method applies a function that accepts and returns a scalar to every element of a DataFrame. Parameters ---------- func : callable Python function, returns a single value...
python
def applymap(self, func): """ Apply a function to a Dataframe elementwise. This method applies a function that accepts and returns a scalar to every element of a DataFrame. Parameters ---------- func : callable Python function, returns a single value...
[ "def", "applymap", "(", "self", ",", "func", ")", ":", "# if we have a dtype == 'M8[ns]', provide boxed values", "def", "infer", "(", "x", ")", ":", "if", "x", ".", "empty", ":", "return", "lib", ".", "map_infer", "(", "x", ",", "func", ")", "return", "lib...
Apply a function to a Dataframe elementwise. This method applies a function that accepts and returns a scalar to every element of a DataFrame. Parameters ---------- func : callable Python function, returns a single value from a single value. Returns ...
[ "Apply", "a", "function", "to", "a", "Dataframe", "elementwise", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L6536-L6600
19,698
pandas-dev/pandas
pandas/core/frame.py
DataFrame.append
def append(self, other, ignore_index=False, verify_integrity=False, sort=None): """ Append rows of `other` to the end of caller, returning a new object. Columns in `other` that are not in the caller are added as new columns. Parameters ---------- other : ...
python
def append(self, other, ignore_index=False, verify_integrity=False, sort=None): """ Append rows of `other` to the end of caller, returning a new object. Columns in `other` that are not in the caller are added as new columns. Parameters ---------- other : ...
[ "def", "append", "(", "self", ",", "other", ",", "ignore_index", "=", "False", ",", "verify_integrity", "=", "False", ",", "sort", "=", "None", ")", ":", "if", "isinstance", "(", "other", ",", "(", "Series", ",", "dict", ")", ")", ":", "if", "isinsta...
Append rows of `other` to the end of caller, returning a new object. Columns in `other` that are not in the caller are added as new columns. Parameters ---------- other : DataFrame or Series/dict-like object, or list of these The data to append. ignore_index : boole...
[ "Append", "rows", "of", "other", "to", "the", "end", "of", "caller", "returning", "a", "new", "object", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L6605-L6739
19,699
pandas-dev/pandas
pandas/core/frame.py
DataFrame.join
def join(self, other, on=None, how='left', lsuffix='', rsuffix='', sort=False): """ Join columns of another DataFrame. Join columns with `other` DataFrame either on index or on a key column. Efficiently join multiple DataFrame objects by index at once by passing a l...
python
def join(self, other, on=None, how='left', lsuffix='', rsuffix='', sort=False): """ Join columns of another DataFrame. Join columns with `other` DataFrame either on index or on a key column. Efficiently join multiple DataFrame objects by index at once by passing a l...
[ "def", "join", "(", "self", ",", "other", ",", "on", "=", "None", ",", "how", "=", "'left'", ",", "lsuffix", "=", "''", ",", "rsuffix", "=", "''", ",", "sort", "=", "False", ")", ":", "# For SparseDataFrame's benefit", "return", "self", ".", "_join_com...
Join columns of another DataFrame. Join columns with `other` DataFrame either on index or on a key column. Efficiently join multiple DataFrame objects by index at once by passing a list. Parameters ---------- other : DataFrame, Series, or list of DataFrame I...
[ "Join", "columns", "of", "another", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L6741-L6862