id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
20,000
pandas-dev/pandas
setup.py
maybe_cythonize
def maybe_cythonize(extensions, *args, **kwargs): """ Render tempita templates before calling cythonize """ if len(sys.argv) > 1 and 'clean' in sys.argv: # Avoid running cythonize on `python setup.py clean` # See https://github.com/cython/cython/issues/1495 return extensions ...
python
def maybe_cythonize(extensions, *args, **kwargs): """ Render tempita templates before calling cythonize """ if len(sys.argv) > 1 and 'clean' in sys.argv: # Avoid running cythonize on `python setup.py clean` # See https://github.com/cython/cython/issues/1495 return extensions ...
[ "def", "maybe_cythonize", "(", "extensions", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", ">", "1", "and", "'clean'", "in", "sys", ".", "argv", ":", "# Avoid running cythonize on `python setup.py clean`", ...
Render tempita templates before calling cythonize
[ "Render", "tempita", "templates", "before", "calling", "cythonize" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/setup.py#L490-L512
20,001
pandas-dev/pandas
pandas/core/groupby/generic.py
NDFrameGroupBy._transform_fast
def _transform_fast(self, result, obj, func_nm): """ Fast transform path for aggregations """ # if there were groups with no observations (Categorical only?) # try casting data to original dtype cast = self._transform_should_cast(func_nm) # for each col, reshape ...
python
def _transform_fast(self, result, obj, func_nm): """ Fast transform path for aggregations """ # if there were groups with no observations (Categorical only?) # try casting data to original dtype cast = self._transform_should_cast(func_nm) # for each col, reshape ...
[ "def", "_transform_fast", "(", "self", ",", "result", ",", "obj", ",", "func_nm", ")", ":", "# if there were groups with no observations (Categorical only?)", "# try casting data to original dtype", "cast", "=", "self", ".", "_transform_should_cast", "(", "func_nm", ")", ...
Fast transform path for aggregations
[ "Fast", "transform", "path", "for", "aggregations" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L526-L545
20,002
pandas-dev/pandas
pandas/core/groupby/generic.py
NDFrameGroupBy.filter
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a DataFrame excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- f : function Function to apply to each subframe. S...
python
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a DataFrame excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- f : function Function to apply to each subframe. S...
[ "def", "filter", "(", "self", ",", "func", ",", "dropna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa", "indices", "=", "[", "]", "obj", "=", "self", ".", "_selected_obj", "gen", "=", "self", ".", "grouper", ".", "ge...
Return a copy of a DataFrame excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- f : function Function to apply to each subframe. Should return True or False. dropna : Drop groups that do not pass the filt...
[ "Return", "a", "copy", "of", "a", "DataFrame", "excluding", "elements", "from", "groups", "that", "do", "not", "satisfy", "the", "boolean", "criterion", "specified", "by", "func", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L601-L661
20,003
pandas-dev/pandas
pandas/core/groupby/generic.py
SeriesGroupBy.filter
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a Series excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- func : function To apply to each group. Should return...
python
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a Series excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- func : function To apply to each group. Should return...
[ "def", "filter", "(", "self", ",", "func", ",", "dropna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa", "if", "isinstance", "(", "func", ",", "str", ")", ":", "wrapper", "=", "lambda", "x", ":", "getattr", "(", "x", ...
Return a copy of a Series excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- func : function To apply to each group. Should return True or False. dropna : Drop groups that do not pass the filter. True by ...
[ "Return", "a", "copy", "of", "a", "Series", "excluding", "elements", "from", "groups", "that", "do", "not", "satisfy", "the", "boolean", "criterion", "specified", "by", "func", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L949-L997
20,004
pandas-dev/pandas
pandas/core/groupby/generic.py
SeriesGroupBy.nunique
def nunique(self, dropna=True): """ Return number of unique elements in the group. """ ids, _, _ = self.grouper.group_info val = self.obj.get_values() try: sorter = np.lexsort((val, ids)) except TypeError: # catches object dtypes msg = '...
python
def nunique(self, dropna=True): """ Return number of unique elements in the group. """ ids, _, _ = self.grouper.group_info val = self.obj.get_values() try: sorter = np.lexsort((val, ids)) except TypeError: # catches object dtypes msg = '...
[ "def", "nunique", "(", "self", ",", "dropna", "=", "True", ")", ":", "ids", ",", "_", ",", "_", "=", "self", ".", "grouper", ".", "group_info", "val", "=", "self", ".", "obj", ".", "get_values", "(", ")", "try", ":", "sorter", "=", "np", ".", "...
Return number of unique elements in the group.
[ "Return", "number", "of", "unique", "elements", "in", "the", "group", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L999-L1054
20,005
pandas-dev/pandas
pandas/core/groupby/generic.py
SeriesGroupBy.pct_change
def pct_change(self, periods=1, fill_method='pad', limit=None, freq=None): """Calcuate pct_change of each value to previous entry in group""" # TODO: Remove this conditional when #23918 is fixed if freq: return self.apply(lambda x: x.pct_change(periods=periods, ...
python
def pct_change(self, periods=1, fill_method='pad', limit=None, freq=None): """Calcuate pct_change of each value to previous entry in group""" # TODO: Remove this conditional when #23918 is fixed if freq: return self.apply(lambda x: x.pct_change(periods=periods, ...
[ "def", "pct_change", "(", "self", ",", "periods", "=", "1", ",", "fill_method", "=", "'pad'", ",", "limit", "=", "None", ",", "freq", "=", "None", ")", ":", "# TODO: Remove this conditional when #23918 is fixed", "if", "freq", ":", "return", "self", ".", "ap...
Calcuate pct_change of each value to previous entry in group
[ "Calcuate", "pct_change", "of", "each", "value", "to", "previous", "entry", "in", "group" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1202-L1213
20,006
pandas-dev/pandas
pandas/core/groupby/generic.py
DataFrameGroupBy._gotitem
def _gotitem(self, key, ndim, subset=None): """ sub-classes to define return a sliced object Parameters ---------- key : string / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on...
python
def _gotitem(self, key, ndim, subset=None): """ sub-classes to define return a sliced object Parameters ---------- key : string / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on...
[ "def", "_gotitem", "(", "self", ",", "key", ",", "ndim", ",", "subset", "=", "None", ")", ":", "if", "ndim", "==", "2", ":", "if", "subset", "is", "None", ":", "subset", "=", "self", ".", "obj", "return", "DataFrameGroupBy", "(", "subset", ",", "se...
sub-classes to define return a sliced object Parameters ---------- key : string / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on
[ "sub", "-", "classes", "to", "define", "return", "a", "sliced", "object" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1297-L1325
20,007
pandas-dev/pandas
pandas/core/groupby/generic.py
DataFrameGroupBy._fill
def _fill(self, direction, limit=None): """Overridden method to join grouped columns in output""" res = super()._fill(direction, limit=limit) output = OrderedDict( (grp.name, grp.grouper) for grp in self.grouper.groupings) from pandas import concat return concat((sel...
python
def _fill(self, direction, limit=None): """Overridden method to join grouped columns in output""" res = super()._fill(direction, limit=limit) output = OrderedDict( (grp.name, grp.grouper) for grp in self.grouper.groupings) from pandas import concat return concat((sel...
[ "def", "_fill", "(", "self", ",", "direction", ",", "limit", "=", "None", ")", ":", "res", "=", "super", "(", ")", ".", "_fill", "(", "direction", ",", "limit", "=", "limit", ")", "output", "=", "OrderedDict", "(", "(", "grp", ".", "name", ",", "...
Overridden method to join grouped columns in output
[ "Overridden", "method", "to", "join", "grouped", "columns", "in", "output" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1472-L1479
20,008
pandas-dev/pandas
pandas/core/groupby/generic.py
DataFrameGroupBy.nunique
def nunique(self, dropna=True): """ Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ...
python
def nunique(self, dropna=True): """ Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ...
[ "def", "nunique", "(", "self", ",", "dropna", "=", "True", ")", ":", "obj", "=", "self", ".", "_selected_obj", "def", "groupby_series", "(", "obj", ",", "col", "=", "None", ")", ":", "return", "SeriesGroupBy", "(", "obj", ",", "selection", "=", "col", ...
Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ------- nunique: DataFrame Examp...
[ "Return", "DataFrame", "with", "number", "of", "distinct", "observations", "per", "group", "for", "each", "column", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1499-L1564
20,009
pandas-dev/pandas
pandas/core/internals/arrays.py
extract_array
def extract_array(obj, extract_numpy=False): """ Extract the ndarray or ExtensionArray from a Series or Index. For all other types, `obj` is just returned as is. Parameters ---------- obj : object For Series / Index, the underlying ExtensionArray is unboxed. For Numpy-backed Ex...
python
def extract_array(obj, extract_numpy=False): """ Extract the ndarray or ExtensionArray from a Series or Index. For all other types, `obj` is just returned as is. Parameters ---------- obj : object For Series / Index, the underlying ExtensionArray is unboxed. For Numpy-backed Ex...
[ "def", "extract_array", "(", "obj", ",", "extract_numpy", "=", "False", ")", ":", "if", "isinstance", "(", "obj", ",", "(", "ABCIndexClass", ",", "ABCSeries", ")", ")", ":", "obj", "=", "obj", ".", "array", "if", "extract_numpy", "and", "isinstance", "("...
Extract the ndarray or ExtensionArray from a Series or Index. For all other types, `obj` is just returned as is. Parameters ---------- obj : object For Series / Index, the underlying ExtensionArray is unboxed. For Numpy-backed ExtensionArrays, the ndarray is extracted. extract_num...
[ "Extract", "the", "ndarray", "or", "ExtensionArray", "from", "a", "Series", "or", "Index", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/arrays.py#L7-L55
20,010
pandas-dev/pandas
pandas/core/common.py
flatten
def flatten(l): """ Flatten an arbitrarily nested sequence. Parameters ---------- l : sequence The non string sequence to flatten Notes ----- This doesn't consider strings sequences. Returns ------- flattened : generator """ for el in l: if _iterabl...
python
def flatten(l): """ Flatten an arbitrarily nested sequence. Parameters ---------- l : sequence The non string sequence to flatten Notes ----- This doesn't consider strings sequences. Returns ------- flattened : generator """ for el in l: if _iterabl...
[ "def", "flatten", "(", "l", ")", ":", "for", "el", "in", "l", ":", "if", "_iterable_not_string", "(", "el", ")", ":", "for", "s", "in", "flatten", "(", "el", ")", ":", "yield", "s", "else", ":", "yield", "el" ]
Flatten an arbitrarily nested sequence. Parameters ---------- l : sequence The non string sequence to flatten Notes ----- This doesn't consider strings sequences. Returns ------- flattened : generator
[ "Flatten", "an", "arbitrarily", "nested", "sequence", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L35-L57
20,011
pandas-dev/pandas
pandas/core/common.py
is_bool_indexer
def is_bool_indexer(key: Any) -> bool: """ Check whether `key` is a valid boolean indexer. Parameters ---------- key : Any Only list-likes may be considered boolean indexers. All other types are not considered a boolean indexer. For array-like input, boolean ndarrays or Exte...
python
def is_bool_indexer(key: Any) -> bool: """ Check whether `key` is a valid boolean indexer. Parameters ---------- key : Any Only list-likes may be considered boolean indexers. All other types are not considered a boolean indexer. For array-like input, boolean ndarrays or Exte...
[ "def", "is_bool_indexer", "(", "key", ":", "Any", ")", "->", "bool", ":", "na_msg", "=", "'cannot index with vector containing NA / NaN values'", "if", "(", "isinstance", "(", "key", ",", "(", "ABCSeries", ",", "np", ".", "ndarray", ",", "ABCIndex", ")", ")", ...
Check whether `key` is a valid boolean indexer. Parameters ---------- key : Any Only list-likes may be considered boolean indexers. All other types are not considered a boolean indexer. For array-like input, boolean ndarrays or ExtensionArrays with ``_is_boolean`` set are co...
[ "Check", "whether", "key", "is", "a", "valid", "boolean", "indexer", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L95-L142
20,012
pandas-dev/pandas
pandas/core/common.py
cast_scalar_indexer
def cast_scalar_indexer(val): """ To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters ---------- val : scalar Returns ------- outval : scalar """ # assumes lib.is_scalar(val) if lib.is_float(val) and val == int(val): return int(val) ...
python
def cast_scalar_indexer(val): """ To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters ---------- val : scalar Returns ------- outval : scalar """ # assumes lib.is_scalar(val) if lib.is_float(val) and val == int(val): return int(val) ...
[ "def", "cast_scalar_indexer", "(", "val", ")", ":", "# assumes lib.is_scalar(val)", "if", "lib", ".", "is_float", "(", "val", ")", "and", "val", "==", "int", "(", "val", ")", ":", "return", "int", "(", "val", ")", "return", "val" ]
To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters ---------- val : scalar Returns ------- outval : scalar
[ "To", "avoid", "numpy", "DeprecationWarnings", "cast", "float", "to", "integer", "where", "valid", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L145-L160
20,013
pandas-dev/pandas
pandas/core/common.py
index_labels_to_array
def index_labels_to_array(labels, dtype=None): """ Transform label or iterable of labels to array, for use in Index. Parameters ---------- dtype : dtype If specified, use as dtype of the resulting array, otherwise infer. Returns ------- array """ if isinstance(labels, (...
python
def index_labels_to_array(labels, dtype=None): """ Transform label or iterable of labels to array, for use in Index. Parameters ---------- dtype : dtype If specified, use as dtype of the resulting array, otherwise infer. Returns ------- array """ if isinstance(labels, (...
[ "def", "index_labels_to_array", "(", "labels", ",", "dtype", "=", "None", ")", ":", "if", "isinstance", "(", "labels", ",", "(", "str", ",", "tuple", ")", ")", ":", "labels", "=", "[", "labels", "]", "if", "not", "isinstance", "(", "labels", ",", "("...
Transform label or iterable of labels to array, for use in Index. Parameters ---------- dtype : dtype If specified, use as dtype of the resulting array, otherwise infer. Returns ------- array
[ "Transform", "label", "or", "iterable", "of", "labels", "to", "array", "for", "use", "in", "Index", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L259-L283
20,014
pandas-dev/pandas
pandas/core/common.py
is_null_slice
def is_null_slice(obj): """ We have a null slice. """ return (isinstance(obj, slice) and obj.start is None and obj.stop is None and obj.step is None)
python
def is_null_slice(obj): """ We have a null slice. """ return (isinstance(obj, slice) and obj.start is None and obj.stop is None and obj.step is None)
[ "def", "is_null_slice", "(", "obj", ")", ":", "return", "(", "isinstance", "(", "obj", ",", "slice", ")", "and", "obj", ".", "start", "is", "None", "and", "obj", ".", "stop", "is", "None", "and", "obj", ".", "step", "is", "None", ")" ]
We have a null slice.
[ "We", "have", "a", "null", "slice", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L292-L297
20,015
pandas-dev/pandas
pandas/core/common.py
is_full_slice
def is_full_slice(obj, l): """ We have a full length slice. """ return (isinstance(obj, slice) and obj.start == 0 and obj.stop == l and obj.step is None)
python
def is_full_slice(obj, l): """ We have a full length slice. """ return (isinstance(obj, slice) and obj.start == 0 and obj.stop == l and obj.step is None)
[ "def", "is_full_slice", "(", "obj", ",", "l", ")", ":", "return", "(", "isinstance", "(", "obj", ",", "slice", ")", "and", "obj", ".", "start", "==", "0", "and", "obj", ".", "stop", "==", "l", "and", "obj", ".", "step", "is", "None", ")" ]
We have a full length slice.
[ "We", "have", "a", "full", "length", "slice", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L308-L313
20,016
pandas-dev/pandas
pandas/core/common.py
apply_if_callable
def apply_if_callable(maybe_callable, obj, **kwargs): """ Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs """ if callable(maybe_callable): ...
python
def apply_if_callable(maybe_callable, obj, **kwargs): """ Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs """ if callable(maybe_callable): ...
[ "def", "apply_if_callable", "(", "maybe_callable", ",", "obj", ",", "*", "*", "kwargs", ")", ":", "if", "callable", "(", "maybe_callable", ")", ":", "return", "maybe_callable", "(", "obj", ",", "*", "*", "kwargs", ")", "return", "maybe_callable" ]
Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs
[ "Evaluate", "possibly", "callable", "input", "using", "obj", "and", "kwargs", "if", "it", "is", "callable", "otherwise", "return", "as", "it", "is", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L333-L348
20,017
pandas-dev/pandas
pandas/core/common.py
standardize_mapping
def standardize_mapping(into): """ Helper function to standardize a supplied mapping. .. versionadded:: 0.21.0 Parameters ---------- into : instance or subclass of collections.abc.Mapping Must be a class, an initialized collections.defaultdict, or an instance of a collections.a...
python
def standardize_mapping(into): """ Helper function to standardize a supplied mapping. .. versionadded:: 0.21.0 Parameters ---------- into : instance or subclass of collections.abc.Mapping Must be a class, an initialized collections.defaultdict, or an instance of a collections.a...
[ "def", "standardize_mapping", "(", "into", ")", ":", "if", "not", "inspect", ".", "isclass", "(", "into", ")", ":", "if", "isinstance", "(", "into", ",", "collections", ".", "defaultdict", ")", ":", "return", "partial", "(", "collections", ".", "defaultdic...
Helper function to standardize a supplied mapping. .. versionadded:: 0.21.0 Parameters ---------- into : instance or subclass of collections.abc.Mapping Must be a class, an initialized collections.defaultdict, or an instance of a collections.abc.Mapping subclass. Returns -----...
[ "Helper", "function", "to", "standardize", "a", "supplied", "mapping", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L368-L401
20,018
pandas-dev/pandas
pandas/core/common.py
random_state
def random_state(state=None): """ Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. ...
python
def random_state(state=None): """ Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. ...
[ "def", "random_state", "(", "state", "=", "None", ")", ":", "if", "is_integer", "(", "state", ")", ":", "return", "np", ".", "random", ".", "RandomState", "(", "state", ")", "elif", "isinstance", "(", "state", ",", "np", ".", "random", ".", "RandomStat...
Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. If receives `None`, returns np.rand...
[ "Helper", "function", "for", "processing", "random_state", "arguments", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L404-L430
20,019
pandas-dev/pandas
pandas/core/common.py
_pipe
def _pipe(obj, func, *args, **kwargs): """ Apply a function ``func`` to object ``obj`` either by passing obj as the first argument to the function or, in the case that the func is a tuple, interpret the first element of the tuple as a function and pass the obj to that function as a keyword argument ...
python
def _pipe(obj, func, *args, **kwargs): """ Apply a function ``func`` to object ``obj`` either by passing obj as the first argument to the function or, in the case that the func is a tuple, interpret the first element of the tuple as a function and pass the obj to that function as a keyword argument ...
[ "def", "_pipe", "(", "obj", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "func", ",", "tuple", ")", ":", "func", ",", "target", "=", "func", "if", "target", "in", "kwargs", ":", "msg", "=", "'%s is bo...
Apply a function ``func`` to object ``obj`` either by passing obj as the first argument to the function or, in the case that the func is a tuple, interpret the first element of the tuple as a function and pass the obj to that function as a keyword argument whose key is the value of the second element of...
[ "Apply", "a", "function", "func", "to", "object", "obj", "either", "by", "passing", "obj", "as", "the", "first", "argument", "to", "the", "function", "or", "in", "the", "case", "that", "the", "func", "is", "a", "tuple", "interpret", "the", "first", "elem...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L433-L465
20,020
pandas-dev/pandas
pandas/core/nanops.py
_get_fill_value
def _get_fill_value(dtype, fill_value=None, fill_value_typ=None): """ return the correct fill value for the dtype of the values """ if fill_value is not None: return fill_value if _na_ok_dtype(dtype): if fill_value_typ is None: return np.nan else: if fill_valu...
python
def _get_fill_value(dtype, fill_value=None, fill_value_typ=None): """ return the correct fill value for the dtype of the values """ if fill_value is not None: return fill_value if _na_ok_dtype(dtype): if fill_value_typ is None: return np.nan else: if fill_valu...
[ "def", "_get_fill_value", "(", "dtype", ",", "fill_value", "=", "None", ",", "fill_value_typ", "=", "None", ")", ":", "if", "fill_value", "is", "not", "None", ":", "return", "fill_value", "if", "_na_ok_dtype", "(", "dtype", ")", ":", "if", "fill_value_typ", ...
return the correct fill value for the dtype of the values
[ "return", "the", "correct", "fill", "value", "for", "the", "dtype", "of", "the", "values" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L180-L200
20,021
pandas-dev/pandas
pandas/core/nanops.py
_get_values
def _get_values(values, skipna, fill_value=None, fill_value_typ=None, isfinite=False, copy=True, mask=None): """ utility to get the values view, mask, dtype if necessary copy and mask using the specified fill_value copy = True will force the copy """ if is_datetime64tz_dtype(values)...
python
def _get_values(values, skipna, fill_value=None, fill_value_typ=None, isfinite=False, copy=True, mask=None): """ utility to get the values view, mask, dtype if necessary copy and mask using the specified fill_value copy = True will force the copy """ if is_datetime64tz_dtype(values)...
[ "def", "_get_values", "(", "values", ",", "skipna", ",", "fill_value", "=", "None", ",", "fill_value_typ", "=", "None", ",", "isfinite", "=", "False", ",", "copy", "=", "True", ",", "mask", "=", "None", ")", ":", "if", "is_datetime64tz_dtype", "(", "valu...
utility to get the values view, mask, dtype if necessary copy and mask using the specified fill_value copy = True will force the copy
[ "utility", "to", "get", "the", "values", "view", "mask", "dtype", "if", "necessary", "copy", "and", "mask", "using", "the", "specified", "fill_value", "copy", "=", "True", "will", "force", "the", "copy" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L203-L258
20,022
pandas-dev/pandas
pandas/core/nanops.py
_wrap_results
def _wrap_results(result, dtype, fill_value=None): """ wrap our results if needed """ if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype): if fill_value is None: # GH#24293 fill_value = iNaT if not isinstance(result, np.ndarray): tz = getattr(dtype,...
python
def _wrap_results(result, dtype, fill_value=None): """ wrap our results if needed """ if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype): if fill_value is None: # GH#24293 fill_value = iNaT if not isinstance(result, np.ndarray): tz = getattr(dtype,...
[ "def", "_wrap_results", "(", "result", ",", "dtype", ",", "fill_value", "=", "None", ")", ":", "if", "is_datetime64_dtype", "(", "dtype", ")", "or", "is_datetime64tz_dtype", "(", "dtype", ")", ":", "if", "fill_value", "is", "None", ":", "# GH#24293", "fill_v...
wrap our results if needed
[ "wrap", "our", "results", "if", "needed" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L276-L304
20,023
pandas-dev/pandas
pandas/core/nanops.py
_na_for_min_count
def _na_for_min_count(values, axis): """Return the missing value for `values` Parameters ---------- values : ndarray axis : int or None axis for the reduction Returns ------- result : scalar or ndarray For 1-D values, returns a scalar of the correct missing type. ...
python
def _na_for_min_count(values, axis): """Return the missing value for `values` Parameters ---------- values : ndarray axis : int or None axis for the reduction Returns ------- result : scalar or ndarray For 1-D values, returns a scalar of the correct missing type. ...
[ "def", "_na_for_min_count", "(", "values", ",", "axis", ")", ":", "# we either return np.nan or pd.NaT", "if", "is_numeric_dtype", "(", "values", ")", ":", "values", "=", "values", ".", "astype", "(", "'float64'", ")", "fill_value", "=", "na_value_for_dtype", "(",...
Return the missing value for `values` Parameters ---------- values : ndarray axis : int or None axis for the reduction Returns ------- result : scalar or ndarray For 1-D values, returns a scalar of the correct missing type. For 2-D values, returns a 1-D array where ...
[ "Return", "the", "missing", "value", "for", "values" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L307-L334
20,024
pandas-dev/pandas
pandas/core/nanops.py
nanany
def nanany(values, axis=None, skipna=True, mask=None): """ Check if any elements along an axis evaluate to True. Parameters ---------- values : ndarray axis : int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- ...
python
def nanany(values, axis=None, skipna=True, mask=None): """ Check if any elements along an axis evaluate to True. Parameters ---------- values : ndarray axis : int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- ...
[ "def", "nanany", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "False", ","...
Check if any elements along an axis evaluate to True. Parameters ---------- values : ndarray axis : int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : bool Examples -------- >>> import pandas.core...
[ "Check", "if", "any", "elements", "along", "an", "axis", "evaluate", "to", "True", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L337-L367
20,025
pandas-dev/pandas
pandas/core/nanops.py
nanall
def nanall(values, axis=None, skipna=True, mask=None): """ Check if all elements along an axis evaluate to True. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- r...
python
def nanall(values, axis=None, skipna=True, mask=None): """ Check if all elements along an axis evaluate to True. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- r...
[ "def", "nanall", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "True", ",",...
Check if all elements along an axis evaluate to True. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : bool Examples -------- >>> import pandas.core....
[ "Check", "if", "all", "elements", "along", "an", "axis", "evaluate", "to", "True", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L370-L400
20,026
pandas-dev/pandas
pandas/core/nanops.py
nansum
def nansum(values, axis=None, skipna=True, min_count=0, mask=None): """ Sum the elements along an axis ignoring NaNs Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mas...
python
def nansum(values, axis=None, skipna=True, min_count=0, mask=None): """ Sum the elements along an axis ignoring NaNs Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mas...
[ "def", "nansum", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "min_count", "=", "0", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "dtype_max", ",", "_", "=", "_get_values", "(", "values"...
Sum the elements along an axis ignoring NaNs Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : dtype Examples -------...
[ "Sum", "the", "elements", "along", "an", "axis", "ignoring", "NaNs" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L404-L438
20,027
pandas-dev/pandas
pandas/core/nanops.py
nanmean
def nanmean(values, axis=None, skipna=True, mask=None): """ Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------...
python
def nanmean(values, axis=None, skipna=True, mask=None): """ Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------...
[ "def", "nanmean", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "dtype_max", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "0", ...
Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in which...
[ "Compute", "the", "mean", "of", "the", "element", "along", "an", "axis", "ignoring", "NaNs" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L443-L491
20,028
pandas-dev/pandas
pandas/core/nanops.py
nanstd
def nanstd(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard deviation along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divis...
python
def nanstd(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard deviation along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divis...
[ "def", "nanstd", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "ddof", "=", "1", ",", "mask", "=", "None", ")", ":", "result", "=", "np", ".", "sqrt", "(", "nanvar", "(", "values", ",", "axis", "=", "axis", ",", "ski...
Compute the standard deviation along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number ...
[ "Compute", "the", "standard", "deviation", "along", "given", "axis", "while", "ignoring", "NaNs" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L581-L611
20,029
pandas-dev/pandas
pandas/core/nanops.py
nanvar
def nanvar(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the variance along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in...
python
def nanvar(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the variance along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in...
[ "def", "nanvar", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "ddof", "=", "1", ",", "mask", "=", "None", ")", ":", "values", "=", "com", ".", "values_from_object", "(", "values", ")", "dtype", "=", "values", ".", "dtyp...
Compute the variance along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of element...
[ "Compute", "the", "variance", "along", "given", "axis", "while", "ignoring", "NaNs" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L616-L679
20,030
pandas-dev/pandas
pandas/core/nanops.py
nansem
def nansem(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard error in the mean along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. T...
python
def nansem(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard error in the mean along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. T...
[ "def", "nansem", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "ddof", "=", "1", ",", "mask", "=", "None", ")", ":", "# This checks if non-numeric-like data is passed with numeric_only=False", "# and raises a TypeError otherwise", "nanvar",...
Compute the standard error in the mean along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the...
[ "Compute", "the", "standard", "error", "in", "the", "mean", "along", "given", "axis", "while", "ignoring", "NaNs" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L683-L723
20,031
pandas-dev/pandas
pandas/core/nanops.py
nanskew
def nanskew(values, axis=None, skipna=True, mask=None): """ Compute the sample skewness. The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G1. The algorithm computes this coefficient directly from the second and third central moment. Parameters --------...
python
def nanskew(values, axis=None, skipna=True, mask=None): """ Compute the sample skewness. The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G1. The algorithm computes this coefficient directly from the second and third central moment. Parameters --------...
[ "def", "nanskew", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", "=", "com", ".", "values_from_object", "(", "values", ")", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(...
Compute the sample skewness. The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G1. The algorithm computes this coefficient directly from the second and third central moment. Parameters ---------- values : ndarray axis: int, optional skipna : boo...
[ "Compute", "the", "sample", "skewness", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L816-L891
20,032
pandas-dev/pandas
pandas/core/nanops.py
nankurt
def nankurt(values, axis=None, skipna=True, mask=None): """ Compute the sample excess kurtosis The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G2, computed directly from the second and fourth central moment. Parameters ---------- values : ndar...
python
def nankurt(values, axis=None, skipna=True, mask=None): """ Compute the sample excess kurtosis The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G2, computed directly from the second and fourth central moment. Parameters ---------- values : ndar...
[ "def", "nankurt", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", "=", "com", ".", "values_from_object", "(", "values", ")", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(...
Compute the sample excess kurtosis The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G2, computed directly from the second and fourth central moment. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask...
[ "Compute", "the", "sample", "excess", "kurtosis" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L895-L980
20,033
pandas-dev/pandas
pandas/core/nanops.py
_nanpercentile_1d
def _nanpercentile_1d(values, mask, q, na_value, interpolation): """ Wraper for np.percentile that skips missing values, specialized to 1-dimensional case. Parameters ---------- values : array over which to find quantiles mask : ndarray[bool] locations in values that should be consi...
python
def _nanpercentile_1d(values, mask, q, na_value, interpolation): """ Wraper for np.percentile that skips missing values, specialized to 1-dimensional case. Parameters ---------- values : array over which to find quantiles mask : ndarray[bool] locations in values that should be consi...
[ "def", "_nanpercentile_1d", "(", "values", ",", "mask", ",", "q", ",", "na_value", ",", "interpolation", ")", ":", "# mask is Union[ExtensionArray, ndarray]", "values", "=", "values", "[", "~", "mask", "]", "if", "len", "(", "values", ")", "==", "0", ":", ...
Wraper for np.percentile that skips missing values, specialized to 1-dimensional case. Parameters ---------- values : array over which to find quantiles mask : ndarray[bool] locations in values that should be considered missing q : scalar or array of quantile indices to find na_valu...
[ "Wraper", "for", "np", ".", "percentile", "that", "skips", "missing", "values", "specialized", "to", "1", "-", "dimensional", "case", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L1203-L1232
20,034
pandas-dev/pandas
pandas/core/nanops.py
nanpercentile
def nanpercentile(values, q, axis, na_value, mask, ndim, interpolation): """ Wraper for np.percentile that skips missing values. Parameters ---------- values : array over which to find quantiles q : scalar or array of quantile indices to find axis : {0, 1} na_value : scalar valu...
python
def nanpercentile(values, q, axis, na_value, mask, ndim, interpolation): """ Wraper for np.percentile that skips missing values. Parameters ---------- values : array over which to find quantiles q : scalar or array of quantile indices to find axis : {0, 1} na_value : scalar valu...
[ "def", "nanpercentile", "(", "values", ",", "q", ",", "axis", ",", "na_value", ",", "mask", ",", "ndim", ",", "interpolation", ")", ":", "if", "not", "lib", ".", "is_scalar", "(", "mask", ")", "and", "mask", ".", "any", "(", ")", ":", "if", "ndim",...
Wraper for np.percentile that skips missing values. Parameters ---------- values : array over which to find quantiles q : scalar or array of quantile indices to find axis : {0, 1} na_value : scalar value to return for empty or all-null values mask : ndarray[bool] locations i...
[ "Wraper", "for", "np", ".", "percentile", "that", "skips", "missing", "values", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L1235-L1272
20,035
pandas-dev/pandas
pandas/io/clipboards.py
read_clipboard
def read_clipboard(sep=r'\s+', **kwargs): # pragma: no cover r""" Read text from clipboard and pass to read_csv. See read_csv for the full argument list Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespa...
python
def read_clipboard(sep=r'\s+', **kwargs): # pragma: no cover r""" Read text from clipboard and pass to read_csv. See read_csv for the full argument list Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespa...
[ "def", "read_clipboard", "(", "sep", "=", "r'\\s+'", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "encoding", "=", "kwargs", ".", "pop", "(", "'encoding'", ",", "'utf-8'", ")", "# only utf-8 is valid for passed value because that's what clipboard", "# supp...
r""" Read text from clipboard and pass to read_csv. See read_csv for the full argument list Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespace characters. Returns ------- parsed : DataFrame
[ "r", "Read", "text", "from", "clipboard", "and", "pass", "to", "read_csv", ".", "See", "read_csv", "for", "the", "full", "argument", "list" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/clipboards.py#L10-L72
20,036
pandas-dev/pandas
pandas/io/clipboards.py
to_clipboard
def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover """ Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : boolean, de...
python
def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover """ Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : boolean, de...
[ "def", "to_clipboard", "(", "obj", ",", "excel", "=", "True", ",", "sep", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "encoding", "=", "kwargs", ".", "pop", "(", "'encoding'", ",", "'utf-8'", ")", "# testing if an invalid encoding i...
Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : boolean, defaults to True if True, use the provided separator, writing in a csv ...
[ "Attempt", "to", "write", "text", "representation", "of", "object", "to", "the", "system", "clipboard", "The", "clipboard", "can", "be", "then", "pasted", "into", "Excel", "for", "example", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/clipboards.py#L75-L132
20,037
pandas-dev/pandas
pandas/io/html.py
_get_skiprows
def _get_skiprows(skiprows): """Get an iterator given an integer, slice or container. Parameters ---------- skiprows : int, slice, container The iterator to use to skip rows; can also be a slice. Raises ------ TypeError * If `skiprows` is not a slice, integer, or Container ...
python
def _get_skiprows(skiprows): """Get an iterator given an integer, slice or container. Parameters ---------- skiprows : int, slice, container The iterator to use to skip rows; can also be a slice. Raises ------ TypeError * If `skiprows` is not a slice, integer, or Container ...
[ "def", "_get_skiprows", "(", "skiprows", ")", ":", "if", "isinstance", "(", "skiprows", ",", "slice", ")", ":", "return", "lrange", "(", "skiprows", ".", "start", "or", "0", ",", "skiprows", ".", "stop", ",", "skiprows", ".", "step", "or", "1", ")", ...
Get an iterator given an integer, slice or container. Parameters ---------- skiprows : int, slice, container The iterator to use to skip rows; can also be a slice. Raises ------ TypeError * If `skiprows` is not a slice, integer, or Container Returns ------- it : it...
[ "Get", "an", "iterator", "given", "an", "integer", "slice", "or", "container", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L85-L110
20,038
pandas-dev/pandas
pandas/io/html.py
_read
def _read(obj): """Try to read from a url, file or string. Parameters ---------- obj : str, unicode, or file-like Returns ------- raw_text : str """ if _is_url(obj): with urlopen(obj) as url: text = url.read() elif hasattr(obj, 'read'): text = obj.re...
python
def _read(obj): """Try to read from a url, file or string. Parameters ---------- obj : str, unicode, or file-like Returns ------- raw_text : str """ if _is_url(obj): with urlopen(obj) as url: text = url.read() elif hasattr(obj, 'read'): text = obj.re...
[ "def", "_read", "(", "obj", ")", ":", "if", "_is_url", "(", "obj", ")", ":", "with", "urlopen", "(", "obj", ")", "as", "url", ":", "text", "=", "url", ".", "read", "(", ")", "elif", "hasattr", "(", "obj", ",", "'read'", ")", ":", "text", "=", ...
Try to read from a url, file or string. Parameters ---------- obj : str, unicode, or file-like Returns ------- raw_text : str
[ "Try", "to", "read", "from", "a", "url", "file", "or", "string", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L113-L139
20,039
pandas-dev/pandas
pandas/io/html.py
_build_xpath_expr
def _build_xpath_expr(attrs): """Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : u...
python
def _build_xpath_expr(attrs): """Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : u...
[ "def", "_build_xpath_expr", "(", "attrs", ")", ":", "# give class attribute as class_ because class is a python keyword", "if", "'class_'", "in", "attrs", ":", "attrs", "[", "'class'", "]", "=", "attrs", ".", "pop", "(", "'class_'", ")", "s", "=", "[", "\"@{key}={...
Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : unicode An XPath expression th...
[ "Build", "an", "xpath", "expression", "to", "simulate", "bs4", "s", "ability", "to", "pass", "in", "kwargs", "to", "search", "for", "attributes", "when", "using", "the", "lxml", "parser", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L601-L620
20,040
pandas-dev/pandas
pandas/io/html.py
_parser_dispatch
def _parser_dispatch(flavor): """Choose the parser based on the input flavor. Parameters ---------- flavor : str The type of parser to use. This must be a valid backend. Returns ------- cls : _HtmlFrameParser subclass The parser class based on the requested input flavor. ...
python
def _parser_dispatch(flavor): """Choose the parser based on the input flavor. Parameters ---------- flavor : str The type of parser to use. This must be a valid backend. Returns ------- cls : _HtmlFrameParser subclass The parser class based on the requested input flavor. ...
[ "def", "_parser_dispatch", "(", "flavor", ")", ":", "valid_parsers", "=", "list", "(", "_valid_parsers", ".", "keys", "(", ")", ")", "if", "flavor", "not", "in", "valid_parsers", ":", "raise", "ValueError", "(", "'{invalid!r} is not a valid flavor, valid flavors '",...
Choose the parser based on the input flavor. Parameters ---------- flavor : str The type of parser to use. This must be a valid backend. Returns ------- cls : _HtmlFrameParser subclass The parser class based on the requested input flavor. Raises ------ ValueError ...
[ "Choose", "the", "parser", "based", "on", "the", "input", "flavor", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L806-L846
20,041
pandas-dev/pandas
pandas/io/html.py
read_html
def read_html(io, match='.+', flavor=None, header=None, index_col=None, skiprows=None, attrs=None, parse_dates=False, tupleize_cols=None, thousands=',', encoding=None, decimal='.', converters=None, na_values=None, keep_default_na=True, displayed_only=True): r"...
python
def read_html(io, match='.+', flavor=None, header=None, index_col=None, skiprows=None, attrs=None, parse_dates=False, tupleize_cols=None, thousands=',', encoding=None, decimal='.', converters=None, na_values=None, keep_default_na=True, displayed_only=True): r"...
[ "def", "read_html", "(", "io", ",", "match", "=", "'.+'", ",", "flavor", "=", "None", ",", "header", "=", "None", ",", "index_col", "=", "None", ",", "skiprows", "=", "None", ",", "attrs", "=", "None", ",", "parse_dates", "=", "False", ",", "tupleize...
r"""Read HTML tables into a ``list`` of ``DataFrame`` objects. Parameters ---------- io : str or file-like A URL, a file-like object, or a raw string containing HTML. Note that lxml only accepts the http, ftp and file url protocols. If you have a URL that starts with ``'https'`` you...
[ "r", "Read", "HTML", "tables", "into", "a", "list", "of", "DataFrame", "objects", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L921-L1088
20,042
pandas-dev/pandas
pandas/io/html.py
_HtmlFrameParser.parse_tables
def parse_tables(self): """ Parse and return all tables from the DOM. Returns ------- list of parsed (header, body, footer) tuples from tables. """ tables = self._parse_tables(self._build_doc(), self.match, self.attrs) return (self._parse_thead_tbody_tfoo...
python
def parse_tables(self): """ Parse and return all tables from the DOM. Returns ------- list of parsed (header, body, footer) tuples from tables. """ tables = self._parse_tables(self._build_doc(), self.match, self.attrs) return (self._parse_thead_tbody_tfoo...
[ "def", "parse_tables", "(", "self", ")", ":", "tables", "=", "self", ".", "_parse_tables", "(", "self", ".", "_build_doc", "(", ")", ",", "self", ".", "match", ",", "self", ".", "attrs", ")", "return", "(", "self", ".", "_parse_thead_tbody_tfoot", "(", ...
Parse and return all tables from the DOM. Returns ------- list of parsed (header, body, footer) tuples from tables.
[ "Parse", "and", "return", "all", "tables", "from", "the", "DOM", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L208-L217
20,043
pandas-dev/pandas
pandas/io/html.py
_HtmlFrameParser._parse_thead_tbody_tfoot
def _parse_thead_tbody_tfoot(self, table_html): """ Given a table, return parsed header, body, and foot. Parameters ---------- table_html : node-like Returns ------- tuple of (header, body, footer), each a list of list-of-text rows. Notes ...
python
def _parse_thead_tbody_tfoot(self, table_html): """ Given a table, return parsed header, body, and foot. Parameters ---------- table_html : node-like Returns ------- tuple of (header, body, footer), each a list of list-of-text rows. Notes ...
[ "def", "_parse_thead_tbody_tfoot", "(", "self", ",", "table_html", ")", ":", "header_rows", "=", "self", ".", "_parse_thead_tr", "(", "table_html", ")", "body_rows", "=", "self", ".", "_parse_tbody_tr", "(", "table_html", ")", "footer_rows", "=", "self", ".", ...
Given a table, return parsed header, body, and foot. Parameters ---------- table_html : node-like Returns ------- tuple of (header, body, footer), each a list of list-of-text rows. Notes ----- Header and body are lists-of-lists. Top level list i...
[ "Given", "a", "table", "return", "parsed", "header", "body", "and", "foot", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L375-L420
20,044
pandas-dev/pandas
pandas/io/html.py
_HtmlFrameParser._handle_hidden_tables
def _handle_hidden_tables(self, tbl_list, attr_name): """ Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Nam...
python
def _handle_hidden_tables(self, tbl_list, attr_name): """ Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Nam...
[ "def", "_handle_hidden_tables", "(", "self", ",", "tbl_list", ",", "attr_name", ")", ":", "if", "not", "self", ".", "displayed_only", ":", "return", "tbl_list", "return", "[", "x", "for", "x", "in", "tbl_list", "if", "\"display:none\"", "not", "in", "getattr...
Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Name of the accessor for retrieving HTML attributes Returns ...
[ "Return", "list", "of", "tables", "potentially", "removing", "hidden", "elements" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L498-L518
20,045
pandas-dev/pandas
pandas/core/dtypes/concat.py
_get_series_result_type
def _get_series_result_type(result, objs=None): """ return appropriate class of Series concat input is either dict or array-like """ from pandas import SparseSeries, SparseDataFrame, DataFrame # concat Series with axis 1 if isinstance(result, dict): # concat Series with axis 1 ...
python
def _get_series_result_type(result, objs=None): """ return appropriate class of Series concat input is either dict or array-like """ from pandas import SparseSeries, SparseDataFrame, DataFrame # concat Series with axis 1 if isinstance(result, dict): # concat Series with axis 1 ...
[ "def", "_get_series_result_type", "(", "result", ",", "objs", "=", "None", ")", ":", "from", "pandas", "import", "SparseSeries", ",", "SparseDataFrame", ",", "DataFrame", "# concat Series with axis 1", "if", "isinstance", "(", "result", ",", "dict", ")", ":", "#...
return appropriate class of Series concat input is either dict or array-like
[ "return", "appropriate", "class", "of", "Series", "concat", "input", "is", "either", "dict", "or", "array", "-", "like" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L59-L79
20,046
pandas-dev/pandas
pandas/core/dtypes/concat.py
_get_frame_result_type
def _get_frame_result_type(result, objs): """ return appropriate class of DataFrame-like concat if all blocks are sparse, return SparseDataFrame otherwise, return 1st obj """ if (result.blocks and ( any(isinstance(obj, ABCSparseDataFrame) for obj in objs))): from pandas.core...
python
def _get_frame_result_type(result, objs): """ return appropriate class of DataFrame-like concat if all blocks are sparse, return SparseDataFrame otherwise, return 1st obj """ if (result.blocks and ( any(isinstance(obj, ABCSparseDataFrame) for obj in objs))): from pandas.core...
[ "def", "_get_frame_result_type", "(", "result", ",", "objs", ")", ":", "if", "(", "result", ".", "blocks", "and", "(", "any", "(", "isinstance", "(", "obj", ",", "ABCSparseDataFrame", ")", "for", "obj", "in", "objs", ")", ")", ")", ":", "from", "pandas...
return appropriate class of DataFrame-like concat if all blocks are sparse, return SparseDataFrame otherwise, return 1st obj
[ "return", "appropriate", "class", "of", "DataFrame", "-", "like", "concat", "if", "all", "blocks", "are", "sparse", "return", "SparseDataFrame", "otherwise", "return", "1st", "obj" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L82-L95
20,047
pandas-dev/pandas
pandas/core/dtypes/concat.py
union_categoricals
def union_categoricals(to_union, sort_categories=False, ignore_order=False): """ Combine list-like of Categorical-like, unioning categories. All categories must have the same dtype. .. versionadded:: 0.19.0 Parameters ---------- to_union : list-like of Categorical, CategoricalIndex, ...
python
def union_categoricals(to_union, sort_categories=False, ignore_order=False): """ Combine list-like of Categorical-like, unioning categories. All categories must have the same dtype. .. versionadded:: 0.19.0 Parameters ---------- to_union : list-like of Categorical, CategoricalIndex, ...
[ "def", "union_categoricals", "(", "to_union", ",", "sort_categories", "=", "False", ",", "ignore_order", "=", "False", ")", ":", "from", "pandas", "import", "Index", ",", "Categorical", ",", "CategoricalIndex", ",", "Series", "from", "pandas", ".", "core", "."...
Combine list-like of Categorical-like, unioning categories. All categories must have the same dtype. .. versionadded:: 0.19.0 Parameters ---------- to_union : list-like of Categorical, CategoricalIndex, or Series with dtype='category' sort_categories : boolean, default False ...
[ "Combine", "list", "-", "like", "of", "Categorical", "-", "like", "unioning", "categories", ".", "All", "categories", "must", "have", "the", "same", "dtype", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L209-L381
20,048
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_datetimetz
def _concat_datetimetz(to_concat, name=None): """ concat DatetimeIndex with the same tz all inputs must be DatetimeIndex it is used in DatetimeIndex.append also """ # Right now, internals will pass a List[DatetimeArray] here # for reductions like quantile. I would like to disentangle # a...
python
def _concat_datetimetz(to_concat, name=None): """ concat DatetimeIndex with the same tz all inputs must be DatetimeIndex it is used in DatetimeIndex.append also """ # Right now, internals will pass a List[DatetimeArray] here # for reductions like quantile. I would like to disentangle # a...
[ "def", "_concat_datetimetz", "(", "to_concat", ",", "name", "=", "None", ")", ":", "# Right now, internals will pass a List[DatetimeArray] here", "# for reductions like quantile. I would like to disentangle", "# all this before we get here.", "sample", "=", "to_concat", "[", "0", ...
concat DatetimeIndex with the same tz all inputs must be DatetimeIndex it is used in DatetimeIndex.append also
[ "concat", "DatetimeIndex", "with", "the", "same", "tz", "all", "inputs", "must", "be", "DatetimeIndex", "it", "is", "used", "in", "DatetimeIndex", ".", "append", "also" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L459-L473
20,049
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_index_asobject
def _concat_index_asobject(to_concat, name=None): """ concat all inputs as object. DatetimeIndex, TimedeltaIndex and PeriodIndex are converted to object dtype before concatenation """ from pandas import Index from pandas.core.arrays import ExtensionArray klasses = (ABCDatetimeIndex, ABCTime...
python
def _concat_index_asobject(to_concat, name=None): """ concat all inputs as object. DatetimeIndex, TimedeltaIndex and PeriodIndex are converted to object dtype before concatenation """ from pandas import Index from pandas.core.arrays import ExtensionArray klasses = (ABCDatetimeIndex, ABCTime...
[ "def", "_concat_index_asobject", "(", "to_concat", ",", "name", "=", "None", ")", ":", "from", "pandas", "import", "Index", "from", "pandas", ".", "core", ".", "arrays", "import", "ExtensionArray", "klasses", "=", "(", "ABCDatetimeIndex", ",", "ABCTimedeltaIndex...
concat all inputs as object. DatetimeIndex, TimedeltaIndex and PeriodIndex are converted to object dtype before concatenation
[ "concat", "all", "inputs", "as", "object", ".", "DatetimeIndex", "TimedeltaIndex", "and", "PeriodIndex", "are", "converted", "to", "object", "dtype", "before", "concatenation" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L481-L501
20,050
pandas-dev/pandas
pandas/util/_exceptions.py
rewrite_exception
def rewrite_exception(old_name, new_name): """Rewrite the message of an exception.""" try: yield except Exception as e: msg = e.args[0] msg = msg.replace(old_name, new_name) args = (msg,) if len(e.args) > 1: args = args + e.args[1:] e.args = args ...
python
def rewrite_exception(old_name, new_name): """Rewrite the message of an exception.""" try: yield except Exception as e: msg = e.args[0] msg = msg.replace(old_name, new_name) args = (msg,) if len(e.args) > 1: args = args + e.args[1:] e.args = args ...
[ "def", "rewrite_exception", "(", "old_name", ",", "new_name", ")", ":", "try", ":", "yield", "except", "Exception", "as", "e", ":", "msg", "=", "e", ".", "args", "[", "0", "]", "msg", "=", "msg", ".", "replace", "(", "old_name", ",", "new_name", ")",...
Rewrite the message of an exception.
[ "Rewrite", "the", "message", "of", "an", "exception", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_exceptions.py#L5-L16
20,051
pandas-dev/pandas
pandas/io/formats/style.py
_get_level_lengths
def _get_level_lengths(index, hidden_elements=None): """ Given an index, find the level length for each element. Optional argument is a list of index positions which should not be visible. Result is a dictionary of (level, inital_position): span """ sentinel = object() levels = index.f...
python
def _get_level_lengths(index, hidden_elements=None): """ Given an index, find the level length for each element. Optional argument is a list of index positions which should not be visible. Result is a dictionary of (level, inital_position): span """ sentinel = object() levels = index.f...
[ "def", "_get_level_lengths", "(", "index", ",", "hidden_elements", "=", "None", ")", ":", "sentinel", "=", "object", "(", ")", "levels", "=", "index", ".", "format", "(", "sparsify", "=", "sentinel", ",", "adjoin", "=", "False", ",", "names", "=", "False...
Given an index, find the level length for each element. Optional argument is a list of index positions which should not be visible. Result is a dictionary of (level, inital_position): span
[ "Given", "an", "index", "find", "the", "level", "length", "for", "each", "element", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1322-L1362
20,052
pandas-dev/pandas
pandas/io/formats/style.py
Styler.format
def format(self, formatter, subset=None): """ Format the text display value of cells. .. versionadded:: 0.18.0 Parameters ---------- formatter : str, callable, or dict subset : IndexSlice An argument to ``DataFrame.loc`` that restricts which elements...
python
def format(self, formatter, subset=None): """ Format the text display value of cells. .. versionadded:: 0.18.0 Parameters ---------- formatter : str, callable, or dict subset : IndexSlice An argument to ``DataFrame.loc`` that restricts which elements...
[ "def", "format", "(", "self", ",", "formatter", ",", "subset", "=", "None", ")", ":", "if", "subset", "is", "None", ":", "row_locs", "=", "range", "(", "len", "(", "self", ".", "data", ")", ")", "col_locs", "=", "range", "(", "len", "(", "self", ...
Format the text display value of cells. .. versionadded:: 0.18.0 Parameters ---------- formatter : str, callable, or dict subset : IndexSlice An argument to ``DataFrame.loc`` that restricts which elements ``formatter`` is applied to. Returns ...
[ "Format", "the", "text", "display", "value", "of", "cells", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L356-L419
20,053
pandas-dev/pandas
pandas/io/formats/style.py
Styler.render
def render(self, **kwargs): """ Render the built up styles to HTML. Parameters ---------- **kwargs Any additional keyword arguments are passed through to ``self.template.render``. This is useful when you need to provide additional ...
python
def render(self, **kwargs): """ Render the built up styles to HTML. Parameters ---------- **kwargs Any additional keyword arguments are passed through to ``self.template.render``. This is useful when you need to provide additional ...
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_compute", "(", ")", "# TODO: namespace all the pandas keys", "d", "=", "self", ".", "_translate", "(", ")", "# filter out empty styles, every cell will have a class", "# but the list of pr...
Render the built up styles to HTML. Parameters ---------- **kwargs Any additional keyword arguments are passed through to ``self.template.render``. This is useful when you need to provide additional variables for a custom template. .....
[ "Render", "the", "built", "up", "styles", "to", "HTML", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L421-L471
20,054
pandas-dev/pandas
pandas/io/formats/style.py
Styler._update_ctx
def _update_ctx(self, attrs): """ Update the state of the Styler. Collects a mapping of {index_label: ['<property>: <value>']}. attrs : Series or DataFrame should contain strings of '<property>: <value>;<prop2>: <val2>' Whitespace shouldn't matter and the final trailing...
python
def _update_ctx(self, attrs): """ Update the state of the Styler. Collects a mapping of {index_label: ['<property>: <value>']}. attrs : Series or DataFrame should contain strings of '<property>: <value>;<prop2>: <val2>' Whitespace shouldn't matter and the final trailing...
[ "def", "_update_ctx", "(", "self", ",", "attrs", ")", ":", "for", "row_label", ",", "v", "in", "attrs", ".", "iterrows", "(", ")", ":", "for", "col_label", ",", "col", "in", "v", ".", "iteritems", "(", ")", ":", "i", "=", "self", ".", "index", "....
Update the state of the Styler. Collects a mapping of {index_label: ['<property>: <value>']}. attrs : Series or DataFrame should contain strings of '<property>: <value>;<prop2>: <val2>' Whitespace shouldn't matter and the final trailing ';' shouldn't matter.
[ "Update", "the", "state", "of", "the", "Styler", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L473-L489
20,055
pandas-dev/pandas
pandas/io/formats/style.py
Styler._compute
def _compute(self): """ Execute the style functions built up in `self._todo`. Relies on the conventions that all style functions go through .apply or .applymap. The append styles to apply as tuples of (application method, *args, **kwargs) """ r = self fo...
python
def _compute(self): """ Execute the style functions built up in `self._todo`. Relies on the conventions that all style functions go through .apply or .applymap. The append styles to apply as tuples of (application method, *args, **kwargs) """ r = self fo...
[ "def", "_compute", "(", "self", ")", ":", "r", "=", "self", "for", "func", ",", "args", ",", "kwargs", "in", "self", ".", "_todo", ":", "r", "=", "func", "(", "self", ")", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "r" ]
Execute the style functions built up in `self._todo`. Relies on the conventions that all style functions go through .apply or .applymap. The append styles to apply as tuples of (application method, *args, **kwargs)
[ "Execute", "the", "style", "functions", "built", "up", "in", "self", ".", "_todo", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L520-L532
20,056
pandas-dev/pandas
pandas/io/formats/style.py
Styler.apply
def apply(self, func, axis=0, subset=None, **kwargs): """ Apply a function column-wise, row-wise, or table-wise, updating the HTML representation with the result. Parameters ---------- func : function ``func`` should take a Series or DataFrame (depending ...
python
def apply(self, func, axis=0, subset=None, **kwargs): """ Apply a function column-wise, row-wise, or table-wise, updating the HTML representation with the result. Parameters ---------- func : function ``func`` should take a Series or DataFrame (depending ...
[ "def", "apply", "(", "self", ",", "func", ",", "axis", "=", "0", ",", "subset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_todo", ".", "append", "(", "(", "lambda", "instance", ":", "getattr", "(", "instance", ",", "'_apply'", ...
Apply a function column-wise, row-wise, or table-wise, updating the HTML representation with the result. Parameters ---------- func : function ``func`` should take a Series or DataFrame (depending on ``axis``), and return an object with the same shape. ...
[ "Apply", "a", "function", "column", "-", "wise", "row", "-", "wise", "or", "table", "-", "wise", "updating", "the", "HTML", "representation", "with", "the", "result", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L567-L614
20,057
pandas-dev/pandas
pandas/io/formats/style.py
Styler.applymap
def applymap(self, func, subset=None, **kwargs): """ Apply a function elementwise, updating the HTML representation with the result. Parameters ---------- func : function ``func`` should take a scalar and return a scalar subset : IndexSlice ...
python
def applymap(self, func, subset=None, **kwargs): """ Apply a function elementwise, updating the HTML representation with the result. Parameters ---------- func : function ``func`` should take a scalar and return a scalar subset : IndexSlice ...
[ "def", "applymap", "(", "self", ",", "func", ",", "subset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_todo", ".", "append", "(", "(", "lambda", "instance", ":", "getattr", "(", "instance", ",", "'_applymap'", ")", ",", "(", "fu...
Apply a function elementwise, updating the HTML representation with the result. Parameters ---------- func : function ``func`` should take a scalar and return a scalar subset : IndexSlice a valid indexer to limit ``data`` to *before* applying the ...
[ "Apply", "a", "function", "elementwise", "updating", "the", "HTML", "representation", "with", "the", "result", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L625-L650
20,058
pandas-dev/pandas
pandas/io/formats/style.py
Styler.where
def where(self, cond, value, other=None, subset=None, **kwargs): """ Apply a function elementwise, updating the HTML representation with a style which is selected in accordance with the return value of a function. .. versionadded:: 0.21.0 Parameters ---------- ...
python
def where(self, cond, value, other=None, subset=None, **kwargs): """ Apply a function elementwise, updating the HTML representation with a style which is selected in accordance with the return value of a function. .. versionadded:: 0.21.0 Parameters ---------- ...
[ "def", "where", "(", "self", ",", "cond", ",", "value", ",", "other", "=", "None", ",", "subset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "other", "is", "None", ":", "other", "=", "''", "return", "self", ".", "applymap", "(", "lambd...
Apply a function elementwise, updating the HTML representation with a style which is selected in accordance with the return value of a function. .. versionadded:: 0.21.0 Parameters ---------- cond : callable ``cond`` should take a scalar and return a boolean...
[ "Apply", "a", "function", "elementwise", "updating", "the", "HTML", "representation", "with", "a", "style", "which", "is", "selected", "in", "accordance", "with", "the", "return", "value", "of", "a", "function", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L652-L687
20,059
pandas-dev/pandas
pandas/io/formats/style.py
Styler.hide_columns
def hide_columns(self, subset): """ Hide columns from rendering. .. versionadded:: 0.23.0 Parameters ---------- subset : IndexSlice An argument to ``DataFrame.loc`` that identifies which columns are hidden. Returns ------- ...
python
def hide_columns(self, subset): """ Hide columns from rendering. .. versionadded:: 0.23.0 Parameters ---------- subset : IndexSlice An argument to ``DataFrame.loc`` that identifies which columns are hidden. Returns ------- ...
[ "def", "hide_columns", "(", "self", ",", "subset", ")", ":", "subset", "=", "_non_reducing_slice", "(", "subset", ")", "hidden_df", "=", "self", ".", "data", ".", "loc", "[", "subset", "]", "self", ".", "hidden_columns", "=", "self", ".", "columns", ".",...
Hide columns from rendering. .. versionadded:: 0.23.0 Parameters ---------- subset : IndexSlice An argument to ``DataFrame.loc`` that identifies which columns are hidden. Returns ------- self : Styler
[ "Hide", "columns", "from", "rendering", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L838-L857
20,060
pandas-dev/pandas
pandas/io/formats/style.py
Styler.highlight_null
def highlight_null(self, null_color='red'): """ Shade the background ``null_color`` for missing values. Parameters ---------- null_color : str Returns ------- self : Styler """ self.applymap(self._highlight_null, null_color=null_color) ...
python
def highlight_null(self, null_color='red'): """ Shade the background ``null_color`` for missing values. Parameters ---------- null_color : str Returns ------- self : Styler """ self.applymap(self._highlight_null, null_color=null_color) ...
[ "def", "highlight_null", "(", "self", ",", "null_color", "=", "'red'", ")", ":", "self", ".", "applymap", "(", "self", ".", "_highlight_null", ",", "null_color", "=", "null_color", ")", "return", "self" ]
Shade the background ``null_color`` for missing values. Parameters ---------- null_color : str Returns ------- self : Styler
[ "Shade", "the", "background", "null_color", "for", "missing", "values", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L868-L881
20,061
pandas-dev/pandas
pandas/io/formats/style.py
Styler._background_gradient
def _background_gradient(s, cmap='PuBu', low=0, high=0, text_color_threshold=0.408): """ Color background in a range according to the data. """ if (not isinstance(text_color_threshold, (float, int)) or not 0 <= text_color_threshold <= 1): ...
python
def _background_gradient(s, cmap='PuBu', low=0, high=0, text_color_threshold=0.408): """ Color background in a range according to the data. """ if (not isinstance(text_color_threshold, (float, int)) or not 0 <= text_color_threshold <= 1): ...
[ "def", "_background_gradient", "(", "s", ",", "cmap", "=", "'PuBu'", ",", "low", "=", "0", ",", "high", "=", "0", ",", "text_color_threshold", "=", "0.408", ")", ":", "if", "(", "not", "isinstance", "(", "text_color_threshold", ",", "(", "float", ",", ...
Color background in a range according to the data.
[ "Color", "background", "in", "a", "range", "according", "to", "the", "data", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L934-L989
20,062
pandas-dev/pandas
pandas/io/formats/style.py
Styler.set_properties
def set_properties(self, subset=None, **kwargs): """ Convenience method for setting one or more non-data dependent properties or each cell. Parameters ---------- subset : IndexSlice a valid slice for ``data`` to limit the style application to kwargs :...
python
def set_properties(self, subset=None, **kwargs): """ Convenience method for setting one or more non-data dependent properties or each cell. Parameters ---------- subset : IndexSlice a valid slice for ``data`` to limit the style application to kwargs :...
[ "def", "set_properties", "(", "self", ",", "subset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "values", "=", "';'", ".", "join", "(", "'{p}: {v}'", ".", "format", "(", "p", "=", "p", ",", "v", "=", "v", ")", "for", "p", ",", "v", "in", ...
Convenience method for setting one or more non-data dependent properties or each cell. Parameters ---------- subset : IndexSlice a valid slice for ``data`` to limit the style application to kwargs : dict property: value pairs to be set for each cell ...
[ "Convenience", "method", "for", "setting", "one", "or", "more", "non", "-", "data", "dependent", "properties", "or", "each", "cell", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L991-L1016
20,063
pandas-dev/pandas
pandas/io/formats/style.py
Styler._bar
def _bar(s, align, colors, width=100, vmin=None, vmax=None): """ Draw bar chart in dataframe cells. """ # Get input value range. smin = s.min() if vmin is None else vmin if isinstance(smin, ABCSeries): smin = smin.min() smax = s.max() if vmax is None e...
python
def _bar(s, align, colors, width=100, vmin=None, vmax=None): """ Draw bar chart in dataframe cells. """ # Get input value range. smin = s.min() if vmin is None else vmin if isinstance(smin, ABCSeries): smin = smin.min() smax = s.max() if vmax is None e...
[ "def", "_bar", "(", "s", ",", "align", ",", "colors", ",", "width", "=", "100", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ")", ":", "# Get input value range.", "smin", "=", "s", ".", "min", "(", ")", "if", "vmin", "is", "None", "else", ...
Draw bar chart in dataframe cells.
[ "Draw", "bar", "chart", "in", "dataframe", "cells", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1019-L1075
20,064
pandas-dev/pandas
pandas/io/formats/style.py
Styler.bar
def bar(self, subset=None, axis=0, color='#d65f5f', width=100, align='left', vmin=None, vmax=None): """ Draw bar chart in the cell backgrounds. Parameters ---------- subset : IndexSlice, optional A valid slice for `data` to limit the style application to....
python
def bar(self, subset=None, axis=0, color='#d65f5f', width=100, align='left', vmin=None, vmax=None): """ Draw bar chart in the cell backgrounds. Parameters ---------- subset : IndexSlice, optional A valid slice for `data` to limit the style application to....
[ "def", "bar", "(", "self", ",", "subset", "=", "None", ",", "axis", "=", "0", ",", "color", "=", "'#d65f5f'", ",", "width", "=", "100", ",", "align", "=", "'left'", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ")", ":", "if", "align", "n...
Draw bar chart in the cell backgrounds. Parameters ---------- subset : IndexSlice, optional A valid slice for `data` to limit the style application to. axis : {0 or 'index', 1 or 'columns', None}, default 0 apply to each column (``axis=0`` or ``'index'``), to eac...
[ "Draw", "bar", "chart", "in", "the", "cell", "backgrounds", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1077-L1145
20,065
pandas-dev/pandas
pandas/io/formats/style.py
Styler.highlight_max
def highlight_max(self, subset=None, color='yellow', axis=0): """ Highlight the maximum by shading the background. Parameters ---------- subset : IndexSlice, default None a valid slice for ``data`` to limit the style application to. color : str, default 'yell...
python
def highlight_max(self, subset=None, color='yellow', axis=0): """ Highlight the maximum by shading the background. Parameters ---------- subset : IndexSlice, default None a valid slice for ``data`` to limit the style application to. color : str, default 'yell...
[ "def", "highlight_max", "(", "self", ",", "subset", "=", "None", ",", "color", "=", "'yellow'", ",", "axis", "=", "0", ")", ":", "return", "self", ".", "_highlight_handler", "(", "subset", "=", "subset", ",", "color", "=", "color", ",", "axis", "=", ...
Highlight the maximum by shading the background. Parameters ---------- subset : IndexSlice, default None a valid slice for ``data`` to limit the style application to. color : str, default 'yellow' axis : {0 or 'index', 1 or 'columns', None}, default 0 app...
[ "Highlight", "the", "maximum", "by", "shading", "the", "background", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1147-L1166
20,066
pandas-dev/pandas
pandas/io/formats/style.py
Styler.highlight_min
def highlight_min(self, subset=None, color='yellow', axis=0): """ Highlight the minimum by shading the background. Parameters ---------- subset : IndexSlice, default None a valid slice for ``data`` to limit the style application to. color : str, default 'yell...
python
def highlight_min(self, subset=None, color='yellow', axis=0): """ Highlight the minimum by shading the background. Parameters ---------- subset : IndexSlice, default None a valid slice for ``data`` to limit the style application to. color : str, default 'yell...
[ "def", "highlight_min", "(", "self", ",", "subset", "=", "None", ",", "color", "=", "'yellow'", ",", "axis", "=", "0", ")", ":", "return", "self", ".", "_highlight_handler", "(", "subset", "=", "subset", ",", "color", "=", "color", ",", "axis", "=", ...
Highlight the minimum by shading the background. Parameters ---------- subset : IndexSlice, default None a valid slice for ``data`` to limit the style application to. color : str, default 'yellow' axis : {0 or 'index', 1 or 'columns', None}, default 0 app...
[ "Highlight", "the", "minimum", "by", "shading", "the", "background", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1168-L1187
20,067
pandas-dev/pandas
pandas/io/formats/style.py
Styler._highlight_extrema
def _highlight_extrema(data, color='yellow', max_=True): """ Highlight the min or max in a Series or DataFrame. """ attr = 'background-color: {0}'.format(color) if data.ndim == 1: # Series from .apply if max_: extrema = data == data.max() ...
python
def _highlight_extrema(data, color='yellow', max_=True): """ Highlight the min or max in a Series or DataFrame. """ attr = 'background-color: {0}'.format(color) if data.ndim == 1: # Series from .apply if max_: extrema = data == data.max() ...
[ "def", "_highlight_extrema", "(", "data", ",", "color", "=", "'yellow'", ",", "max_", "=", "True", ")", ":", "attr", "=", "'background-color: {0}'", ".", "format", "(", "color", ")", "if", "data", ".", "ndim", "==", "1", ":", "# Series from .apply", "if", ...
Highlight the min or max in a Series or DataFrame.
[ "Highlight", "the", "min", "or", "max", "in", "a", "Series", "or", "DataFrame", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1197-L1214
20,068
pandas-dev/pandas
pandas/io/formats/style.py
Styler.from_custom_template
def from_custom_template(cls, searchpath, name): """ Factory function for creating a subclass of ``Styler`` with a custom template and Jinja environment. Parameters ---------- searchpath : str or list Path or paths of directories containing the templates ...
python
def from_custom_template(cls, searchpath, name): """ Factory function for creating a subclass of ``Styler`` with a custom template and Jinja environment. Parameters ---------- searchpath : str or list Path or paths of directories containing the templates ...
[ "def", "from_custom_template", "(", "cls", ",", "searchpath", ",", "name", ")", ":", "loader", "=", "ChoiceLoader", "(", "[", "FileSystemLoader", "(", "searchpath", ")", ",", "cls", ".", "loader", ",", "]", ")", "class", "MyStyler", "(", "cls", ")", ":",...
Factory function for creating a subclass of ``Styler`` with a custom template and Jinja environment. Parameters ---------- searchpath : str or list Path or paths of directories containing the templates name : str Name of your custom template to use for re...
[ "Factory", "function", "for", "creating", "a", "subclass", "of", "Styler", "with", "a", "custom", "template", "and", "Jinja", "environment", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1217-L1243
20,069
pandas-dev/pandas
pandas/core/indexes/numeric.py
Int64Index._assert_safe_casting
def _assert_safe_casting(cls, data, subarr): """ Ensure incoming data can be represented as ints. """ if not issubclass(data.dtype.type, np.signedinteger): if not np.array_equal(data, subarr): raise TypeError('Unsafe NumPy casting, you must ' ...
python
def _assert_safe_casting(cls, data, subarr): """ Ensure incoming data can be represented as ints. """ if not issubclass(data.dtype.type, np.signedinteger): if not np.array_equal(data, subarr): raise TypeError('Unsafe NumPy casting, you must ' ...
[ "def", "_assert_safe_casting", "(", "cls", ",", "data", ",", "subarr", ")", ":", "if", "not", "issubclass", "(", "data", ".", "dtype", ".", "type", ",", "np", ".", "signedinteger", ")", ":", "if", "not", "np", ".", "array_equal", "(", "data", ",", "s...
Ensure incoming data can be represented as ints.
[ "Ensure", "incoming", "data", "can", "be", "represented", "as", "ints", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/numeric.py#L215-L222
20,070
pandas-dev/pandas
pandas/core/indexes/numeric.py
Float64Index.get_value
def get_value(self, series, key): """ we always want to get an index value, never a value """ if not is_scalar(key): raise InvalidIndexError k = com.values_from_object(key) loc = self.get_loc(k) new_values = com.values_from_object(series)[loc] return new_val...
python
def get_value(self, series, key): """ we always want to get an index value, never a value """ if not is_scalar(key): raise InvalidIndexError k = com.values_from_object(key) loc = self.get_loc(k) new_values = com.values_from_object(series)[loc] return new_val...
[ "def", "get_value", "(", "self", ",", "series", ",", "key", ")", ":", "if", "not", "is_scalar", "(", "key", ")", ":", "raise", "InvalidIndexError", "k", "=", "com", ".", "values_from_object", "(", "key", ")", "loc", "=", "self", ".", "get_loc", "(", ...
we always want to get an index value, never a value
[ "we", "always", "want", "to", "get", "an", "index", "value", "never", "a", "value" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/numeric.py#L364-L373
20,071
pandas-dev/pandas
pandas/io/pytables.py
to_hdf
def to_hdf(path_or_buf, key, value, mode=None, complevel=None, complib=None, append=None, **kwargs): """ store this object, close it if we opened it """ if append: f = lambda store: store.append(key, value, **kwargs) else: f = lambda store: store.put(key, value, **kwargs) pa...
python
def to_hdf(path_or_buf, key, value, mode=None, complevel=None, complib=None, append=None, **kwargs): """ store this object, close it if we opened it """ if append: f = lambda store: store.append(key, value, **kwargs) else: f = lambda store: store.put(key, value, **kwargs) pa...
[ "def", "to_hdf", "(", "path_or_buf", ",", "key", ",", "value", ",", "mode", "=", "None", ",", "complevel", "=", "None", ",", "complib", "=", "None", ",", "append", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "append", ":", "f", "=", "la...
store this object, close it if we opened it
[ "store", "this", "object", "close", "it", "if", "we", "opened", "it" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L248-L263
20,072
pandas-dev/pandas
pandas/io/pytables.py
read_hdf
def read_hdf(path_or_buf, key=None, mode='r', **kwargs): """ Read from the store, close it if we opened it. Retrieve pandas object stored in file, optionally based on where criteria Parameters ---------- path_or_buf : string, buffer or path object Path to the file to open, or an op...
python
def read_hdf(path_or_buf, key=None, mode='r', **kwargs): """ Read from the store, close it if we opened it. Retrieve pandas object stored in file, optionally based on where criteria Parameters ---------- path_or_buf : string, buffer or path object Path to the file to open, or an op...
[ "def", "read_hdf", "(", "path_or_buf", ",", "key", "=", "None", ",", "mode", "=", "'r'", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "not", "in", "[", "'r'", ",", "'r+'", ",", "'a'", "]", ":", "raise", "ValueError", "(", "'mode {0} is not allowe...
Read from the store, close it if we opened it. Retrieve pandas object stored in file, optionally based on where criteria Parameters ---------- path_or_buf : string, buffer or path object Path to the file to open, or an open :class:`pandas.HDFStore` object. Supports any object imple...
[ "Read", "from", "the", "store", "close", "it", "if", "we", "opened", "it", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L266-L384
20,073
pandas-dev/pandas
pandas/io/pytables.py
_is_metadata_of
def _is_metadata_of(group, parent_group): """Check if a given group is a metadata group for a given parent_group.""" if group._v_depth <= parent_group._v_depth: return False current = group while current._v_depth > 1: parent = current._v_parent if parent == parent_group and curr...
python
def _is_metadata_of(group, parent_group): """Check if a given group is a metadata group for a given parent_group.""" if group._v_depth <= parent_group._v_depth: return False current = group while current._v_depth > 1: parent = current._v_parent if parent == parent_group and curr...
[ "def", "_is_metadata_of", "(", "group", ",", "parent_group", ")", ":", "if", "group", ".", "_v_depth", "<=", "parent_group", ".", "_v_depth", ":", "return", "False", "current", "=", "group", "while", "current", ".", "_v_depth", ">", "1", ":", "parent", "="...
Check if a given group is a metadata group for a given parent_group.
[ "Check", "if", "a", "given", "group", "is", "a", "metadata", "group", "for", "a", "given", "parent_group", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L387-L398
20,074
pandas-dev/pandas
pandas/io/pytables.py
_get_tz
def _get_tz(tz): """ for a tz-aware type, return an encoded zone """ zone = timezones.get_timezone(tz) if zone is None: zone = tz.utcoffset().total_seconds() return zone
python
def _get_tz(tz): """ for a tz-aware type, return an encoded zone """ zone = timezones.get_timezone(tz) if zone is None: zone = tz.utcoffset().total_seconds() return zone
[ "def", "_get_tz", "(", "tz", ")", ":", "zone", "=", "timezones", ".", "get_timezone", "(", "tz", ")", "if", "zone", "is", "None", ":", "zone", "=", "tz", ".", "utcoffset", "(", ")", ".", "total_seconds", "(", ")", "return", "zone" ]
for a tz-aware type, return an encoded zone
[ "for", "a", "tz", "-", "aware", "type", "return", "an", "encoded", "zone" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4356-L4361
20,075
pandas-dev/pandas
pandas/io/pytables.py
_set_tz
def _set_tz(values, tz, preserve_UTC=False, coerce=False): """ coerce the values to a DatetimeIndex if tz is set preserve the input shape if possible Parameters ---------- values : ndarray tz : string/pickled tz object preserve_UTC : boolean, preserve the UTC of the result c...
python
def _set_tz(values, tz, preserve_UTC=False, coerce=False): """ coerce the values to a DatetimeIndex if tz is set preserve the input shape if possible Parameters ---------- values : ndarray tz : string/pickled tz object preserve_UTC : boolean, preserve the UTC of the result c...
[ "def", "_set_tz", "(", "values", ",", "tz", ",", "preserve_UTC", "=", "False", ",", "coerce", "=", "False", ")", ":", "if", "tz", "is", "not", "None", ":", "name", "=", "getattr", "(", "values", ",", "'name'", ",", "None", ")", "values", "=", "valu...
coerce the values to a DatetimeIndex if tz is set preserve the input shape if possible Parameters ---------- values : ndarray tz : string/pickled tz object preserve_UTC : boolean, preserve the UTC of the result coerce : if we do not have a passed timezone, coerce to M8[ns] ndarray
[ "coerce", "the", "values", "to", "a", "DatetimeIndex", "if", "tz", "is", "set", "preserve", "the", "input", "shape", "if", "possible" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4364-L4390
20,076
pandas-dev/pandas
pandas/io/pytables.py
_convert_string_array
def _convert_string_array(data, encoding, errors, itemsize=None): """ we take a string-like that is object dtype and coerce to a fixed size string type Parameters ---------- data : a numpy array of object dtype encoding : None or string-encoding errors : handler for encoding errors ...
python
def _convert_string_array(data, encoding, errors, itemsize=None): """ we take a string-like that is object dtype and coerce to a fixed size string type Parameters ---------- data : a numpy array of object dtype encoding : None or string-encoding errors : handler for encoding errors ...
[ "def", "_convert_string_array", "(", "data", ",", "encoding", ",", "errors", ",", "itemsize", "=", "None", ")", ":", "# encode if needed", "if", "encoding", "is", "not", "None", "and", "len", "(", "data", ")", ":", "data", "=", "Series", "(", "data", "."...
we take a string-like that is object dtype and coerce to a fixed size string type Parameters ---------- data : a numpy array of object dtype encoding : None or string-encoding errors : handler for encoding errors itemsize : integer, optional, defaults to the max length of the strings R...
[ "we", "take", "a", "string", "-", "like", "that", "is", "object", "dtype", "and", "coerce", "to", "a", "fixed", "size", "string", "type" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4521-L4549
20,077
pandas-dev/pandas
pandas/io/pytables.py
_unconvert_string_array
def _unconvert_string_array(data, nan_rep=None, encoding=None, errors='strict'): """ inverse of _convert_string_array Parameters ---------- data : fixed length string dtyped array nan_rep : the storage repr of NaN, optional encoding : the encoding of the data, op...
python
def _unconvert_string_array(data, nan_rep=None, encoding=None, errors='strict'): """ inverse of _convert_string_array Parameters ---------- data : fixed length string dtyped array nan_rep : the storage repr of NaN, optional encoding : the encoding of the data, op...
[ "def", "_unconvert_string_array", "(", "data", ",", "nan_rep", "=", "None", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ")", ":", "shape", "=", "data", ".", "shape", "data", "=", "np", ".", "asarray", "(", "data", ".", "ravel", "(", ...
inverse of _convert_string_array Parameters ---------- data : fixed length string dtyped array nan_rep : the storage repr of NaN, optional encoding : the encoding of the data, optional errors : handler for encoding errors, default 'strict' Returns ------- an object array of the dec...
[ "inverse", "of", "_convert_string_array" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4552-L4589
20,078
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.open
def open(self, mode='a', **kwargs): """ Open the file in the specified mode Parameters ---------- mode : {'a', 'w', 'r', 'r+'}, default 'a' See HDFStore docstring or tables.open_file for info about modes """ tables = _tables() if self._mode !...
python
def open(self, mode='a', **kwargs): """ Open the file in the specified mode Parameters ---------- mode : {'a', 'w', 'r', 'r+'}, default 'a' See HDFStore docstring or tables.open_file for info about modes """ tables = _tables() if self._mode !...
[ "def", "open", "(", "self", ",", "mode", "=", "'a'", ",", "*", "*", "kwargs", ")", ":", "tables", "=", "_tables", "(", ")", "if", "self", ".", "_mode", "!=", "mode", ":", "# if we are changing a write mode to read, ok", "if", "self", ".", "_mode", "in", ...
Open the file in the specified mode Parameters ---------- mode : {'a', 'w', 'r', 'r+'}, default 'a' See HDFStore docstring or tables.open_file for info about modes
[ "Open", "the", "file", "in", "the", "specified", "mode" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L553-L624
20,079
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.flush
def flush(self, fsync=False): """ Force all buffered modifications to be written to disk. Parameters ---------- fsync : bool (default False) call ``os.fsync()`` on the file handle to force writing to disk. Notes ----- Without ``fsync=True``, fl...
python
def flush(self, fsync=False): """ Force all buffered modifications to be written to disk. Parameters ---------- fsync : bool (default False) call ``os.fsync()`` on the file handle to force writing to disk. Notes ----- Without ``fsync=True``, fl...
[ "def", "flush", "(", "self", ",", "fsync", "=", "False", ")", ":", "if", "self", ".", "_handle", "is", "not", "None", ":", "self", ".", "_handle", ".", "flush", "(", ")", "if", "fsync", ":", "try", ":", "os", ".", "fsync", "(", "self", ".", "_h...
Force all buffered modifications to be written to disk. Parameters ---------- fsync : bool (default False) call ``os.fsync()`` on the file handle to force writing to disk. Notes ----- Without ``fsync=True``, flushing may not guarantee that the OS writes ...
[ "Force", "all", "buffered", "modifications", "to", "be", "written", "to", "disk", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L643-L665
20,080
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.get
def get(self, key): """ Retrieve pandas object stored in file Parameters ---------- key : object Returns ------- obj : same type as object stored in file """ group = self.get_node(key) if group is None: raise KeyError(...
python
def get(self, key): """ Retrieve pandas object stored in file Parameters ---------- key : object Returns ------- obj : same type as object stored in file """ group = self.get_node(key) if group is None: raise KeyError(...
[ "def", "get", "(", "self", ",", "key", ")", ":", "group", "=", "self", ".", "get_node", "(", "key", ")", "if", "group", "is", "None", ":", "raise", "KeyError", "(", "'No object named {key} in the file'", ".", "format", "(", "key", "=", "key", ")", ")",...
Retrieve pandas object stored in file Parameters ---------- key : object Returns ------- obj : same type as object stored in file
[ "Retrieve", "pandas", "object", "stored", "in", "file" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L667-L682
20,081
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.select
def select(self, key, where=None, start=None, stop=None, columns=None, iterator=False, chunksize=None, auto_close=False, **kwargs): """ Retrieve pandas object stored in file, optionally based on where criteria Parameters ---------- key : object whe...
python
def select(self, key, where=None, start=None, stop=None, columns=None, iterator=False, chunksize=None, auto_close=False, **kwargs): """ Retrieve pandas object stored in file, optionally based on where criteria Parameters ---------- key : object whe...
[ "def", "select", "(", "self", ",", "key", ",", "where", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "columns", "=", "None", ",", "iterator", "=", "False", ",", "chunksize", "=", "None", ",", "auto_close", "=", "False", ",...
Retrieve pandas object stored in file, optionally based on where criteria Parameters ---------- key : object where : list of Term (or convertible) objects, optional start : integer (defaults to None), row number to start selection stop : integer (defaults to Non...
[ "Retrieve", "pandas", "object", "stored", "in", "file", "optionally", "based", "on", "where", "criteria" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L684-L727
20,082
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.select_as_coordinates
def select_as_coordinates( self, key, where=None, start=None, stop=None, **kwargs): """ return the selection as an Index Parameters ---------- key : object where : list of Term (or convertible) objects, optional start : integer (defaults to None), row...
python
def select_as_coordinates( self, key, where=None, start=None, stop=None, **kwargs): """ return the selection as an Index Parameters ---------- key : object where : list of Term (or convertible) objects, optional start : integer (defaults to None), row...
[ "def", "select_as_coordinates", "(", "self", ",", "key", ",", "where", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "*", "*", "kwargs", ")", ":", "where", "=", "_ensure_term", "(", "where", ",", "scope_level", "=", "1", ")",...
return the selection as an Index Parameters ---------- key : object where : list of Term (or convertible) objects, optional start : integer (defaults to None), row number to start selection stop : integer (defaults to None), row number to stop selection
[ "return", "the", "selection", "as", "an", "Index" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L729-L743
20,083
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.select_column
def select_column(self, key, column, **kwargs): """ return a single column from the table. This is generally only useful to select an indexable Parameters ---------- key : object column: the column of interest Exceptions ---------- raises...
python
def select_column(self, key, column, **kwargs): """ return a single column from the table. This is generally only useful to select an indexable Parameters ---------- key : object column: the column of interest Exceptions ---------- raises...
[ "def", "select_column", "(", "self", ",", "key", ",", "column", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "get_storer", "(", "key", ")", ".", "read_column", "(", "column", "=", "column", ",", "*", "*", "kwargs", ")" ]
return a single column from the table. This is generally only useful to select an indexable Parameters ---------- key : object column: the column of interest Exceptions ---------- raises KeyError if the column is not found (or key is not a valid ...
[ "return", "a", "single", "column", "from", "the", "table", ".", "This", "is", "generally", "only", "useful", "to", "select", "an", "indexable" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L745-L763
20,084
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.select_as_multiple
def select_as_multiple(self, keys, where=None, selector=None, columns=None, start=None, stop=None, iterator=False, chunksize=None, auto_close=False, **kwargs): """ Retrieve pandas objects from multiple tables Parameters ---------- ke...
python
def select_as_multiple(self, keys, where=None, selector=None, columns=None, start=None, stop=None, iterator=False, chunksize=None, auto_close=False, **kwargs): """ Retrieve pandas objects from multiple tables Parameters ---------- ke...
[ "def", "select_as_multiple", "(", "self", ",", "keys", ",", "where", "=", "None", ",", "selector", "=", "None", ",", "columns", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "iterator", "=", "False", ",", "chunksize", "=", "N...
Retrieve pandas objects from multiple tables Parameters ---------- keys : a list of the tables selector : the table to apply the where criteria (defaults to keys[0] if not supplied) columns : the columns I want back start : integer (defaults to None), row num...
[ "Retrieve", "pandas", "objects", "from", "multiple", "tables" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L765-L846
20,085
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.put
def put(self, key, value, format=None, append=False, **kwargs): """ Store object in HDFStore Parameters ---------- key : object value : {Series, DataFrame} format : 'fixed(f)|table(t)', default is 'fixed' fixed(f) : Fixed format ...
python
def put(self, key, value, format=None, append=False, **kwargs): """ Store object in HDFStore Parameters ---------- key : object value : {Series, DataFrame} format : 'fixed(f)|table(t)', default is 'fixed' fixed(f) : Fixed format ...
[ "def", "put", "(", "self", ",", "key", ",", "value", ",", "format", "=", "None", ",", "append", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "format", "is", "None", ":", "format", "=", "get_option", "(", "\"io.hdf.default_format\"", ")", "o...
Store object in HDFStore Parameters ---------- key : object value : {Series, DataFrame} format : 'fixed(f)|table(t)', default is 'fixed' fixed(f) : Fixed format Fast writing/reading. Not-appendable, nor searchable table(t)...
[ "Store", "object", "in", "HDFStore" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L848-L876
20,086
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.remove
def remove(self, key, where=None, start=None, stop=None): """ Remove pandas object partially by specifying the where condition Parameters ---------- key : string Node to remove or delete rows from where : list of Term (or convertible) objects, optional ...
python
def remove(self, key, where=None, start=None, stop=None): """ Remove pandas object partially by specifying the where condition Parameters ---------- key : string Node to remove or delete rows from where : list of Term (or convertible) objects, optional ...
[ "def", "remove", "(", "self", ",", "key", ",", "where", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "where", "=", "_ensure_term", "(", "where", ",", "scope_level", "=", "1", ")", "try", ":", "s", "=", "self", ".", ...
Remove pandas object partially by specifying the where condition Parameters ---------- key : string Node to remove or delete rows from where : list of Term (or convertible) objects, optional start : integer (defaults to None), row number to start selection st...
[ "Remove", "pandas", "object", "partially", "by", "specifying", "the", "where", "condition" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L878-L926
20,087
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.append
def append(self, key, value, format=None, append=True, columns=None, dropna=None, **kwargs): """ Append to Table in file. Node must already exist and be Table format. Parameters ---------- key : object value : {Series, DataFrame} format : '...
python
def append(self, key, value, format=None, append=True, columns=None, dropna=None, **kwargs): """ Append to Table in file. Node must already exist and be Table format. Parameters ---------- key : object value : {Series, DataFrame} format : '...
[ "def", "append", "(", "self", ",", "key", ",", "value", ",", "format", "=", "None", ",", "append", "=", "True", ",", "columns", "=", "None", ",", "dropna", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "columns", "is", "not", "None", ":",...
Append to Table in file. Node must already exist and be Table format. Parameters ---------- key : object value : {Series, DataFrame} format : 'table' is the default table(t) : table format Write as a PyTables Table structure which may p...
[ "Append", "to", "Table", "in", "file", ".", "Node", "must", "already", "exist", "and", "be", "Table", "format", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L928-L973
20,088
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.append_to_multiple
def append_to_multiple(self, d, value, selector, data_columns=None, axes=None, dropna=False, **kwargs): """ Append to multiple tables Parameters ---------- d : a dict of table_name to table_columns, None is acceptable as the values of one n...
python
def append_to_multiple(self, d, value, selector, data_columns=None, axes=None, dropna=False, **kwargs): """ Append to multiple tables Parameters ---------- d : a dict of table_name to table_columns, None is acceptable as the values of one n...
[ "def", "append_to_multiple", "(", "self", ",", "d", ",", "value", ",", "selector", ",", "data_columns", "=", "None", ",", "axes", "=", "None", ",", "dropna", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "axes", "is", "not", "None", ":", "...
Append to multiple tables Parameters ---------- d : a dict of table_name to table_columns, None is acceptable as the values of one node (this will get all the remaining columns) value : a pandas object selector : a string that designates the indexable table; all of i...
[ "Append", "to", "multiple", "tables" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L975-L1055
20,089
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.walk
def walk(self, where="/"): """ Walk the pytables group hierarchy for pandas objects This generator will yield the group path, subgroups and pandas object names for each group. Any non-pandas PyTables objects that are not a group will be ignored. The `where` group itself is list...
python
def walk(self, where="/"): """ Walk the pytables group hierarchy for pandas objects This generator will yield the group path, subgroups and pandas object names for each group. Any non-pandas PyTables objects that are not a group will be ignored. The `where` group itself is list...
[ "def", "walk", "(", "self", ",", "where", "=", "\"/\"", ")", ":", "_tables", "(", ")", "self", ".", "_check_if_open", "(", ")", "for", "g", "in", "self", ".", "_handle", ".", "walk_groups", "(", "where", ")", ":", "if", "getattr", "(", "g", ".", ...
Walk the pytables group hierarchy for pandas objects This generator will yield the group path, subgroups and pandas object names for each group. Any non-pandas PyTables objects that are not a group will be ignored. The `where` group itself is listed first (preorder), then each of its ...
[ "Walk", "the", "pytables", "group", "hierarchy", "for", "pandas", "objects" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1095-L1139
20,090
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.get_node
def get_node(self, key): """ return the node with the key or None if it does not exist """ self._check_if_open() try: if not key.startswith('/'): key = '/' + key return self._handle.get_node(self.root, key) except _table_mod.exceptions.NoSuchNodeEr...
python
def get_node(self, key): """ return the node with the key or None if it does not exist """ self._check_if_open() try: if not key.startswith('/'): key = '/' + key return self._handle.get_node(self.root, key) except _table_mod.exceptions.NoSuchNodeEr...
[ "def", "get_node", "(", "self", ",", "key", ")", ":", "self", ".", "_check_if_open", "(", ")", "try", ":", "if", "not", "key", ".", "startswith", "(", "'/'", ")", ":", "key", "=", "'/'", "+", "key", "return", "self", ".", "_handle", ".", "get_node"...
return the node with the key or None if it does not exist
[ "return", "the", "node", "with", "the", "key", "or", "None", "if", "it", "does", "not", "exist" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1141-L1149
20,091
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.get_storer
def get_storer(self, key): """ return the storer object for a key, raise if not in the file """ group = self.get_node(key) if group is None: raise KeyError('No object named {key} in the file'.format(key=key)) s = self._create_storer(group) s.infer_axes() retu...
python
def get_storer(self, key): """ return the storer object for a key, raise if not in the file """ group = self.get_node(key) if group is None: raise KeyError('No object named {key} in the file'.format(key=key)) s = self._create_storer(group) s.infer_axes() retu...
[ "def", "get_storer", "(", "self", ",", "key", ")", ":", "group", "=", "self", ".", "get_node", "(", "key", ")", "if", "group", "is", "None", ":", "raise", "KeyError", "(", "'No object named {key} in the file'", ".", "format", "(", "key", "=", "key", ")",...
return the storer object for a key, raise if not in the file
[ "return", "the", "storer", "object", "for", "a", "key", "raise", "if", "not", "in", "the", "file" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1151-L1159
20,092
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.copy
def copy(self, file, mode='w', propindexes=True, keys=None, complib=None, complevel=None, fletcher32=False, overwrite=True): """ copy the existing store to a new file, upgrading in place Parameters ---------- propindexes: restore indexes in copied file (defaults...
python
def copy(self, file, mode='w', propindexes=True, keys=None, complib=None, complevel=None, fletcher32=False, overwrite=True): """ copy the existing store to a new file, upgrading in place Parameters ---------- propindexes: restore indexes in copied file (defaults...
[ "def", "copy", "(", "self", ",", "file", ",", "mode", "=", "'w'", ",", "propindexes", "=", "True", ",", "keys", "=", "None", ",", "complib", "=", "None", ",", "complevel", "=", "None", ",", "fletcher32", "=", "False", ",", "overwrite", "=", "True", ...
copy the existing store to a new file, upgrading in place Parameters ---------- propindexes: restore indexes in copied file (defaults to True) keys : list of keys to include in the copy (defaults to all) overwrite : overwrite (remove and replace) exist...
[ "copy", "the", "existing", "store", "to", "a", "new", "file", "upgrading", "in", "place" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1161-L1210
20,093
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.info
def info(self): """ Print detailed information on the store. .. versionadded:: 0.21.0 """ output = '{type}\nFile path: {path}\n'.format( type=type(self), path=pprint_thing(self._path)) if self.is_open: lkeys = sorted(list(self.keys())) ...
python
def info(self): """ Print detailed information on the store. .. versionadded:: 0.21.0 """ output = '{type}\nFile path: {path}\n'.format( type=type(self), path=pprint_thing(self._path)) if self.is_open: lkeys = sorted(list(self.keys())) ...
[ "def", "info", "(", "self", ")", ":", "output", "=", "'{type}\\nFile path: {path}\\n'", ".", "format", "(", "type", "=", "type", "(", "self", ")", ",", "path", "=", "pprint_thing", "(", "self", ".", "_path", ")", ")", "if", "self", ".", "is_open", ":",...
Print detailed information on the store. .. versionadded:: 0.21.0
[ "Print", "detailed", "information", "on", "the", "store", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1212-L1245
20,094
pandas-dev/pandas
pandas/io/pytables.py
HDFStore._create_storer
def _create_storer(self, group, format=None, value=None, append=False, **kwargs): """ return a suitable class to operate """ def error(t): raise TypeError( "cannot properly create the storer for: [{t}] [group->" "{group},value->{value},...
python
def _create_storer(self, group, format=None, value=None, append=False, **kwargs): """ return a suitable class to operate """ def error(t): raise TypeError( "cannot properly create the storer for: [{t}] [group->" "{group},value->{value},...
[ "def", "_create_storer", "(", "self", ",", "group", ",", "format", "=", "None", ",", "value", "=", "None", ",", "append", "=", "False", ",", "*", "*", "kwargs", ")", ":", "def", "error", "(", "t", ")", ":", "raise", "TypeError", "(", "\"cannot proper...
return a suitable class to operate
[ "return", "a", "suitable", "class", "to", "operate" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1265-L1350
20,095
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.set_name
def set_name(self, name, kind_attr=None): """ set the name of this indexer """ self.name = name self.kind_attr = kind_attr or "{name}_kind".format(name=name) if self.cname is None: self.cname = name return self
python
def set_name(self, name, kind_attr=None): """ set the name of this indexer """ self.name = name self.kind_attr = kind_attr or "{name}_kind".format(name=name) if self.cname is None: self.cname = name return self
[ "def", "set_name", "(", "self", ",", "name", ",", "kind_attr", "=", "None", ")", ":", "self", ".", "name", "=", "name", "self", ".", "kind_attr", "=", "kind_attr", "or", "\"{name}_kind\"", ".", "format", "(", "name", "=", "name", ")", "if", "self", "...
set the name of this indexer
[ "set", "the", "name", "of", "this", "indexer" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1552-L1559
20,096
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.set_pos
def set_pos(self, pos): """ set the position of this column in the Table """ self.pos = pos if pos is not None and self.typ is not None: self.typ._v_pos = pos return self
python
def set_pos(self, pos): """ set the position of this column in the Table """ self.pos = pos if pos is not None and self.typ is not None: self.typ._v_pos = pos return self
[ "def", "set_pos", "(", "self", ",", "pos", ")", ":", "self", ".", "pos", "=", "pos", "if", "pos", "is", "not", "None", "and", "self", ".", "typ", "is", "not", "None", ":", "self", ".", "typ", ".", "_v_pos", "=", "pos", "return", "self" ]
set the position of this column in the Table
[ "set", "the", "position", "of", "this", "column", "in", "the", "Table" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1567-L1572
20,097
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.is_indexed
def is_indexed(self): """ return whether I am an indexed column """ try: return getattr(self.table.cols, self.cname).is_indexed except AttributeError: False
python
def is_indexed(self): """ return whether I am an indexed column """ try: return getattr(self.table.cols, self.cname).is_indexed except AttributeError: False
[ "def", "is_indexed", "(", "self", ")", ":", "try", ":", "return", "getattr", "(", "self", ".", "table", ".", "cols", ",", "self", ".", "cname", ")", ".", "is_indexed", "except", "AttributeError", ":", "False" ]
return whether I am an indexed column
[ "return", "whether", "I", "am", "an", "indexed", "column" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1599-L1604
20,098
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.set_info
def set_info(self, info): """ set my state from the passed info """ idx = info.get(self.name) if idx is not None: self.__dict__.update(idx)
python
def set_info(self, info): """ set my state from the passed info """ idx = info.get(self.name) if idx is not None: self.__dict__.update(idx)
[ "def", "set_info", "(", "self", ",", "info", ")", ":", "idx", "=", "info", ".", "get", "(", "self", ".", "name", ")", "if", "idx", "is", "not", "None", ":", "self", ".", "__dict__", ".", "update", "(", "idx", ")" ]
set my state from the passed info
[ "set", "my", "state", "from", "the", "passed", "info" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1766-L1770
20,099
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.validate_metadata
def validate_metadata(self, handler): """ validate that kind=category does not change the categories """ if self.meta == 'category': new_metadata = self.metadata cur_metadata = handler.read_metadata(self.cname) if (new_metadata is not None and cur_metadata is not None...
python
def validate_metadata(self, handler): """ validate that kind=category does not change the categories """ if self.meta == 'category': new_metadata = self.metadata cur_metadata = handler.read_metadata(self.cname) if (new_metadata is not None and cur_metadata is not None...
[ "def", "validate_metadata", "(", "self", ",", "handler", ")", ":", "if", "self", ".", "meta", "==", "'category'", ":", "new_metadata", "=", "self", ".", "metadata", "cur_metadata", "=", "handler", ".", "read_metadata", "(", "self", ".", "cname", ")", "if",...
validate that kind=category does not change the categories
[ "validate", "that", "kind", "=", "category", "does", "not", "change", "the", "categories" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1784-L1792