repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
pandas-dev/pandas
pandas/core/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
train
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
train
pandas-dev/pandas
pandas/core/nanops.py
nanargmax
def nanargmax(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of max value in specified...
python
def nanargmax(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of max value in specified...
[ "def", "nanargmax", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "fill_value...
Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of max value in specified axis or -1 in the NA case Examples -------- >>> import p...
[ "Parameters", "----------", "values", ":", "ndarray", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", "mask", "if", "known" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L756-L782
train
pandas-dev/pandas
pandas/core/nanops.py
nanargmin
def nanargmin(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of min value in specified...
python
def nanargmin(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of min value in specified...
[ "def", "nanargmin", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "fill_value...
Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of min value in specified axis or -1 in the NA case Examples -------- >>> import p...
[ "Parameters", "----------", "values", ":", "ndarray", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", "mask", "if", "known" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L786-L812
train
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
train
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
train
pandas-dev/pandas
pandas/core/nanops.py
nanprod
def nanprod(values, axis=None, skipna=True, min_count=0, mask=None): """ 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 : ...
python
def nanprod(values, axis=None, skipna=True, min_count=0, mask=None): """ 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 : ...
[ "def", "nanprod", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "min_count", "=", "0", ",", "mask", "=", "None", ")", ":", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(", "values", ")", "if", "skipna", "and"...
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 -------- >>> import pandas.core.nanops as nanops ...
[ "Parameters", "----------", "values", ":", "ndarray", "[", "dtype", "]", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "min_count", ":", "int", "default", "0", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L984-L1016
train
pandas-dev/pandas
pandas/core/nanops.py
nancorr
def nancorr(a, b, method='pearson', min_periods=None): """ a, b: ndarrays """ if len(a) != len(b): raise AssertionError('Operands to nancorr must have same size') if min_periods is None: min_periods = 1 valid = notna(a) & notna(b) if not valid.all(): a = a[valid] ...
python
def nancorr(a, b, method='pearson', min_periods=None): """ a, b: ndarrays """ if len(a) != len(b): raise AssertionError('Operands to nancorr must have same size') if min_periods is None: min_periods = 1 valid = notna(a) & notna(b) if not valid.all(): a = a[valid] ...
[ "def", "nancorr", "(", "a", ",", "b", ",", "method", "=", "'pearson'", ",", "min_periods", "=", "None", ")", ":", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", ":", "raise", "AssertionError", "(", "'Operands to nancorr must have same size'", ")...
a, b: ndarrays
[ "a", "b", ":", "ndarrays" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L1083-L1102
train
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
train
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
train
pandas-dev/pandas
pandas/io/formats/html.py
HTMLFormatter.write_th
def write_th(self, s, header=False, indent=0, tags=None): """ Method for writting a formatted <th> cell. If col_space is set on the formatter then that is used for the value of min-width. Parameters ---------- s : object The data to be written inside...
python
def write_th(self, s, header=False, indent=0, tags=None): """ Method for writting a formatted <th> cell. If col_space is set on the formatter then that is used for the value of min-width. Parameters ---------- s : object The data to be written inside...
[ "def", "write_th", "(", "self", ",", "s", ",", "header", "=", "False", ",", "indent", "=", "0", ",", "tags", "=", "None", ")", ":", "if", "header", "and", "self", ".", "fmt", ".", "col_space", "is", "not", "None", ":", "tags", "=", "(", "tags", ...
Method for writting a formatted <th> cell. If col_space is set on the formatter then that is used for the value of min-width. Parameters ---------- s : object The data to be written inside the cell. header : boolean, default False Set to True if ...
[ "Method", "for", "writting", "a", "formatted", "<th", ">", "cell", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/html.py#L90-L118
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/io/html.py
_HtmlFrameParser._expand_colspan_rowspan
def _expand_colspan_rowspan(self, rows): """ Given a list of <tr>s, return a list of text rows. Parameters ---------- rows : list of node-like List of <tr>s Returns ------- list of list Each returned row is a list of str text. ...
python
def _expand_colspan_rowspan(self, rows): """ Given a list of <tr>s, return a list of text rows. Parameters ---------- rows : list of node-like List of <tr>s Returns ------- list of list Each returned row is a list of str text. ...
[ "def", "_expand_colspan_rowspan", "(", "self", ",", "rows", ")", ":", "all_texts", "=", "[", "]", "# list of rows, each a list of str", "remainder", "=", "[", "]", "# list of (index, text, nrows)", "for", "tr", "in", "rows", ":", "texts", "=", "[", "]", "# the o...
Given a list of <tr>s, return a list of text rows. Parameters ---------- rows : list of node-like List of <tr>s Returns ------- list of list Each returned row is a list of str text. Notes ----- Any cell with ``rowspan`` o...
[ "Given", "a", "list", "of", "<tr", ">", "s", "return", "a", "list", "of", "text", "rows", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L422-L496
train
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
train
pandas-dev/pandas
pandas/io/html.py
_LxmlFrameParser._build_doc
def _build_doc(self): """ Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet ...
python
def _build_doc(self): """ Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet ...
[ "def", "_build_doc", "(", "self", ")", ":", "from", "lxml", ".", "html", "import", "parse", ",", "fromstring", ",", "HTMLParser", "from", "lxml", ".", "etree", "import", "XMLSyntaxError", "parser", "=", "HTMLParser", "(", "recover", "=", "True", ",", "enco...
Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet connection will fail. See...
[ "Raises", "------", "ValueError", "*", "If", "a", "URL", "that", "lxml", "cannot", "parse", "is", "passed", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L690-L735
train
pandas-dev/pandas
pandas/core/dtypes/concat.py
get_dtype_kinds
def get_dtype_kinds(l): """ Parameters ---------- l : list of arrays Returns ------- a set of kinds that exist in this list of arrays """ typs = set() for arr in l: dtype = arr.dtype if is_categorical_dtype(dtype): typ = 'category' elif is_s...
python
def get_dtype_kinds(l): """ Parameters ---------- l : list of arrays Returns ------- a set of kinds that exist in this list of arrays """ typs = set() for arr in l: dtype = arr.dtype if is_categorical_dtype(dtype): typ = 'category' elif is_s...
[ "def", "get_dtype_kinds", "(", "l", ")", ":", "typs", "=", "set", "(", ")", "for", "arr", "in", "l", ":", "dtype", "=", "arr", ".", "dtype", "if", "is_categorical_dtype", "(", "dtype", ")", ":", "typ", "=", "'category'", "elif", "is_sparse", "(", "ar...
Parameters ---------- l : list of arrays Returns ------- a set of kinds that exist in this list of arrays
[ "Parameters", "----------", "l", ":", "list", "of", "arrays" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L18-L56
train
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
train
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
train
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_compat
def _concat_compat(to_concat, axis=0): """ provide concatenation of an array of arrays each of which is a single 'normalized' dtypes (in that for example, if it's object, then it is a non-datetimelike and provide a combined dtype for the resulting array that preserves the overall dtype if possible) ...
python
def _concat_compat(to_concat, axis=0): """ provide concatenation of an array of arrays each of which is a single 'normalized' dtypes (in that for example, if it's object, then it is a non-datetimelike and provide a combined dtype for the resulting array that preserves the overall dtype if possible) ...
[ "def", "_concat_compat", "(", "to_concat", ",", "axis", "=", "0", ")", ":", "# filter empty arrays", "# 1-d dtypes always are included here", "def", "is_nonempty", "(", "x", ")", ":", "try", ":", "return", "x", ".", "shape", "[", "axis", "]", ">", "0", "exce...
provide concatenation of an array of arrays each of which is a single 'normalized' dtypes (in that for example, if it's object, then it is a non-datetimelike and provide a combined dtype for the resulting array that preserves the overall dtype if possible) Parameters ---------- to_concat : arra...
[ "provide", "concatenation", "of", "an", "array", "of", "arrays", "each", "of", "which", "is", "a", "single", "normalized", "dtypes", "(", "in", "that", "for", "example", "if", "it", "s", "object", "then", "it", "is", "a", "non", "-", "datetimelike", "and...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L98-L165
train
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_categorical
def _concat_categorical(to_concat, axis=0): """Concatenate an object/categorical array of arrays, each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : int Axis to provide concatenation in the current implementation this is always 0, e.g. we on...
python
def _concat_categorical(to_concat, axis=0): """Concatenate an object/categorical array of arrays, each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : int Axis to provide concatenation in the current implementation this is always 0, e.g. we on...
[ "def", "_concat_categorical", "(", "to_concat", ",", "axis", "=", "0", ")", ":", "# we could have object blocks and categoricals here", "# if we only have a single categoricals then combine everything", "# else its a non-compat categorical", "categoricals", "=", "[", "x", "for", ...
Concatenate an object/categorical array of arrays, each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : int Axis to provide concatenation in the current implementation this is always 0, e.g. we only have 1D categoricals Returns ------- ...
[ "Concatenate", "an", "object", "/", "categorical", "array", "of", "arrays", "each", "of", "which", "is", "a", "single", "dtype" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L168-L206
train
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
train
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_datetime
def _concat_datetime(to_concat, axis=0, typs=None): """ provide concatenation of an datetimelike array of arrays each of which is a single M8[ns], datetimet64[ns, tz] or m8[ns] dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_...
python
def _concat_datetime(to_concat, axis=0, typs=None): """ provide concatenation of an datetimelike array of arrays each of which is a single M8[ns], datetimet64[ns, tz] or m8[ns] dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_...
[ "def", "_concat_datetime", "(", "to_concat", ",", "axis", "=", "0", ",", "typs", "=", "None", ")", ":", "if", "typs", "is", "None", ":", "typs", "=", "get_dtype_kinds", "(", "to_concat", ")", "# multiple types, need to coerce to object", "if", "len", "(", "t...
provide concatenation of an datetimelike array of arrays each of which is a single M8[ns], datetimet64[ns, tz] or m8[ns] dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_concat dtypes Returns ------- a single array, prese...
[ "provide", "concatenation", "of", "an", "datetimelike", "array", "of", "arrays", "each", "of", "which", "is", "a", "single", "M8", "[", "ns", "]", "datetimet64", "[", "ns", "tz", "]", "or", "m8", "[", "ns", "]", "dtype" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L391-L435
train
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
train
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
train
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_sparse
def _concat_sparse(to_concat, axis=0, typs=None): """ provide concatenation of an sparse/dense array of arrays each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_concat dtypes Returns ------- ...
python
def _concat_sparse(to_concat, axis=0, typs=None): """ provide concatenation of an sparse/dense array of arrays each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_concat dtypes Returns ------- ...
[ "def", "_concat_sparse", "(", "to_concat", ",", "axis", "=", "0", ",", "typs", "=", "None", ")", ":", "from", "pandas", ".", "core", ".", "arrays", "import", "SparseArray", "fill_values", "=", "[", "x", ".", "fill_value", "for", "x", "in", "to_concat", ...
provide concatenation of an sparse/dense array of arrays each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_concat dtypes Returns ------- a single array, preserving the combined dtypes
[ "provide", "concatenation", "of", "an", "sparse", "/", "dense", "array", "of", "arrays", "each", "of", "which", "is", "a", "single", "dtype" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L504-L531
train
pandas-dev/pandas
pandas/core/dtypes/concat.py
_concat_rangeindex_same_dtype
def _concat_rangeindex_same_dtype(indexes): """ Concatenates multiple RangeIndex instances. All members of "indexes" must be of type RangeIndex; result will be RangeIndex if possible, Int64Index otherwise. E.g.: indexes = [RangeIndex(3), RangeIndex(3, 6)] -> RangeIndex(6) indexes = [RangeIndex(3...
python
def _concat_rangeindex_same_dtype(indexes): """ Concatenates multiple RangeIndex instances. All members of "indexes" must be of type RangeIndex; result will be RangeIndex if possible, Int64Index otherwise. E.g.: indexes = [RangeIndex(3), RangeIndex(3, 6)] -> RangeIndex(6) indexes = [RangeIndex(3...
[ "def", "_concat_rangeindex_same_dtype", "(", "indexes", ")", ":", "from", "pandas", "import", "Int64Index", ",", "RangeIndex", "start", "=", "step", "=", "next", "=", "None", "# Filter the empty indexes", "non_empty_indexes", "=", "[", "obj", "for", "obj", "in", ...
Concatenates multiple RangeIndex instances. All members of "indexes" must be of type RangeIndex; result will be RangeIndex if possible, Int64Index otherwise. E.g.: indexes = [RangeIndex(3), RangeIndex(3, 6)] -> RangeIndex(6) indexes = [RangeIndex(3), RangeIndex(4, 6)] -> Int64Index([0,1,2,4,5])
[ "Concatenates", "multiple", "RangeIndex", "instances", ".", "All", "members", "of", "indexes", "must", "be", "of", "type", "RangeIndex", ";", "result", "will", "be", "RangeIndex", "if", "possible", "Int64Index", "otherwise", ".", "E", ".", "g", ".", ":", "in...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L534-L578
train
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
train
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
train
pandas-dev/pandas
pandas/io/formats/style.py
Styler._translate
def _translate(self): """ Convert the DataFrame in `self.data` and the attrs from `_build_styles` into a dictionary of {head, body, uuid, cellstyle}. """ table_styles = self.table_styles or [] caption = self.caption ctx = self.ctx precision = self.precisio...
python
def _translate(self): """ Convert the DataFrame in `self.data` and the attrs from `_build_styles` into a dictionary of {head, body, uuid, cellstyle}. """ table_styles = self.table_styles or [] caption = self.caption ctx = self.ctx precision = self.precisio...
[ "def", "_translate", "(", "self", ")", ":", "table_styles", "=", "self", ".", "table_styles", "or", "[", "]", "caption", "=", "self", ".", "caption", "ctx", "=", "self", ".", "ctx", "precision", "=", "self", ".", "precision", "hidden_index", "=", "self",...
Convert the DataFrame in `self.data` and the attrs from `_build_styles` into a dictionary of {head, body, uuid, cellstyle}.
[ "Convert", "the", "DataFrame", "in", "self", ".", "data", "and", "the", "attrs", "from", "_build_styles", "into", "a", "dictionary", "of", "{", "head", "body", "uuid", "cellstyle", "}", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L189-L354
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/io/formats/style.py
Styler.background_gradient
def background_gradient(self, cmap='PuBu', low=0, high=0, axis=0, subset=None, text_color_threshold=0.408): """ Color the background in a gradient according to the data in each column (optionally row). Requires matplotlib. Parameters --------...
python
def background_gradient(self, cmap='PuBu', low=0, high=0, axis=0, subset=None, text_color_threshold=0.408): """ Color the background in a gradient according to the data in each column (optionally row). Requires matplotlib. Parameters --------...
[ "def", "background_gradient", "(", "self", ",", "cmap", "=", "'PuBu'", ",", "low", "=", "0", ",", "high", "=", "0", ",", "axis", "=", "0", ",", "subset", "=", "None", ",", "text_color_threshold", "=", "0.408", ")", ":", "subset", "=", "_maybe_numeric_s...
Color the background in a gradient according to the data in each column (optionally row). Requires matplotlib. Parameters ---------- cmap : str or colormap matplotlib colormap low, high : float compress the range by these values. axis : {...
[ "Color", "the", "background", "in", "a", "gradient", "according", "to", "the", "data", "in", "each", "column", "(", "optionally", "row", ")", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L883-L931
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/core/dtypes/dtypes.py
Registry.register
def register(self, dtype): """ Parameters ---------- dtype : ExtensionDtype """ if not issubclass(dtype, (PandasExtensionDtype, ExtensionDtype)): raise ValueError("can only register pandas extension dtypes") self.dtypes.append(dtype)
python
def register(self, dtype): """ Parameters ---------- dtype : ExtensionDtype """ if not issubclass(dtype, (PandasExtensionDtype, ExtensionDtype)): raise ValueError("can only register pandas extension dtypes") self.dtypes.append(dtype)
[ "def", "register", "(", "self", ",", "dtype", ")", ":", "if", "not", "issubclass", "(", "dtype", ",", "(", "PandasExtensionDtype", ",", "ExtensionDtype", ")", ")", ":", "raise", "ValueError", "(", "\"can only register pandas extension dtypes\"", ")", "self", "."...
Parameters ---------- dtype : ExtensionDtype
[ "Parameters", "----------", "dtype", ":", "ExtensionDtype" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/dtypes.py#L60-L69
train
pandas-dev/pandas
pandas/core/dtypes/dtypes.py
Registry.find
def find(self, dtype): """ Parameters ---------- dtype : PandasExtensionDtype or string Returns ------- return the first matching dtype, otherwise return None """ if not isinstance(dtype, str): dtype_type = dtype if not isi...
python
def find(self, dtype): """ Parameters ---------- dtype : PandasExtensionDtype or string Returns ------- return the first matching dtype, otherwise return None """ if not isinstance(dtype, str): dtype_type = dtype if not isi...
[ "def", "find", "(", "self", ",", "dtype", ")", ":", "if", "not", "isinstance", "(", "dtype", ",", "str", ")", ":", "dtype_type", "=", "dtype", "if", "not", "isinstance", "(", "dtype", ",", "type", ")", ":", "dtype_type", "=", "type", "(", "dtype", ...
Parameters ---------- dtype : PandasExtensionDtype or string Returns ------- return the first matching dtype, otherwise return None
[ "Parameters", "----------", "dtype", ":", "PandasExtensionDtype", "or", "string" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/dtypes.py#L71-L96
train
pandas-dev/pandas
pandas/compat/numpy/__init__.py
np_datetime64_compat
def np_datetime64_compat(s, *args, **kwargs): """ provide compat for construction of strings to numpy datetime64's with tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation warning, when need to pass '2015-01-01 09:00:00' """ s = tz_replacer(s) return np.datetime64(s, *args...
python
def np_datetime64_compat(s, *args, **kwargs): """ provide compat for construction of strings to numpy datetime64's with tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation warning, when need to pass '2015-01-01 09:00:00' """ s = tz_replacer(s) return np.datetime64(s, *args...
[ "def", "np_datetime64_compat", "(", "s", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "s", "=", "tz_replacer", "(", "s", ")", "return", "np", ".", "datetime64", "(", "s", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
provide compat for construction of strings to numpy datetime64's with tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation warning, when need to pass '2015-01-01 09:00:00'
[ "provide", "compat", "for", "construction", "of", "strings", "to", "numpy", "datetime64", "s", "with", "tz", "-", "changes", "in", "1", ".", "11", "that", "make", "2015", "-", "01", "-", "01", "09", ":", "00", ":", "00Z", "show", "a", "deprecation", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/__init__.py#L37-L44
train
pandas-dev/pandas
pandas/compat/numpy/__init__.py
np_array_datetime64_compat
def np_array_datetime64_compat(arr, *args, **kwargs): """ provide compat for construction of an array of strings to a np.array(..., dtype=np.datetime64(..)) tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation warning, when need to pass '2015-01-01 09:00:00' """ # is_list_l...
python
def np_array_datetime64_compat(arr, *args, **kwargs): """ provide compat for construction of an array of strings to a np.array(..., dtype=np.datetime64(..)) tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation warning, when need to pass '2015-01-01 09:00:00' """ # is_list_l...
[ "def", "np_array_datetime64_compat", "(", "arr", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# is_list_like", "if", "(", "hasattr", "(", "arr", ",", "'__iter__'", ")", "and", "not", "isinstance", "(", "arr", ",", "(", "str", ",", "bytes", ")"...
provide compat for construction of an array of strings to a np.array(..., dtype=np.datetime64(..)) tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation warning, when need to pass '2015-01-01 09:00:00'
[ "provide", "compat", "for", "construction", "of", "an", "array", "of", "strings", "to", "a", "np", ".", "array", "(", "...", "dtype", "=", "np", ".", "datetime64", "(", "..", "))", "tz", "-", "changes", "in", "1", ".", "11", "that", "make", "2015", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/__init__.py#L47-L60
train
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
train
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
train
pandas-dev/pandas
pandas/core/indexes/numeric.py
Float64Index.equals
def equals(self, other): """ Determines if two Index objects contain the same elements. """ if self is other: return True if not isinstance(other, Index): return False # need to compare nans locations and make sure that they are the same ...
python
def equals(self, other): """ Determines if two Index objects contain the same elements. """ if self is other: return True if not isinstance(other, Index): return False # need to compare nans locations and make sure that they are the same ...
[ "def", "equals", "(", "self", ",", "other", ")", ":", "if", "self", "is", "other", ":", "return", "True", "if", "not", "isinstance", "(", "other", ",", "Index", ")", ":", "return", "False", "# need to compare nans locations and make sure that they are the same", ...
Determines if two Index objects contain the same elements.
[ "Determines", "if", "two", "Index", "objects", "contain", "the", "same", "elements", "." ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/numeric.py#L375-L396
train
pandas-dev/pandas
pandas/io/pytables.py
_ensure_decoded
def _ensure_decoded(s): """ if we have bytes, decode them to unicode """ if isinstance(s, np.bytes_): s = s.decode('UTF-8') return s
python
def _ensure_decoded(s): """ if we have bytes, decode them to unicode """ if isinstance(s, np.bytes_): s = s.decode('UTF-8') return s
[ "def", "_ensure_decoded", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "np", ".", "bytes_", ")", ":", "s", "=", "s", ".", "decode", "(", "'UTF-8'", ")", "return", "s" ]
if we have bytes, decode them to unicode
[ "if", "we", "have", "bytes", "decode", "them", "to", "unicode" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L51-L55
train
pandas-dev/pandas
pandas/io/pytables.py
_ensure_term
def _ensure_term(where, scope_level): """ ensure that the where is a Term or a list of Term this makes sure that we are capturing the scope of variables that are passed create the terms here with a frame_level=2 (we are 2 levels down) """ # only consider list/tuple here as an ndarray is aut...
python
def _ensure_term(where, scope_level): """ ensure that the where is a Term or a list of Term this makes sure that we are capturing the scope of variables that are passed create the terms here with a frame_level=2 (we are 2 levels down) """ # only consider list/tuple here as an ndarray is aut...
[ "def", "_ensure_term", "(", "where", ",", "scope_level", ")", ":", "# only consider list/tuple here as an ndarray is automatically a coordinate", "# list", "level", "=", "scope_level", "+", "1", "if", "isinstance", "(", "where", ",", "(", "list", ",", "tuple", ")", ...
ensure that the where is a Term or a list of Term this makes sure that we are capturing the scope of variables that are passed create the terms here with a frame_level=2 (we are 2 levels down)
[ "ensure", "that", "the", "where", "is", "a", "Term", "or", "a", "list", "of", "Term", "this", "makes", "sure", "that", "we", "are", "capturing", "the", "scope", "of", "variables", "that", "are", "passed", "create", "the", "terms", "here", "with", "a", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L81-L102
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/io/pytables.py
_get_info
def _get_info(info, name): """ get/create the info for this name """ try: idx = info[name] except KeyError: idx = info[name] = dict() return idx
python
def _get_info(info, name): """ get/create the info for this name """ try: idx = info[name] except KeyError: idx = info[name] = dict() return idx
[ "def", "_get_info", "(", "info", ",", "name", ")", ":", "try", ":", "idx", "=", "info", "[", "name", "]", "except", "KeyError", ":", "idx", "=", "info", "[", "name", "]", "=", "dict", "(", ")", "return", "idx" ]
get/create the info for this name
[ "get", "/", "create", "the", "info", "for", "this", "name" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4345-L4351
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.create_table_index
def create_table_index(self, key, **kwargs): """ Create a pytables index on the table Parameters ---------- key : object (the node to index) Exceptions ---------- raises if the node is not a table """ # version requirements _tables() ...
python
def create_table_index(self, key, **kwargs): """ Create a pytables index on the table Parameters ---------- key : object (the node to index) Exceptions ---------- raises if the node is not a table """ # version requirements _tables() ...
[ "def", "create_table_index", "(", "self", ",", "key", ",", "*", "*", "kwargs", ")", ":", "# version requirements", "_tables", "(", ")", "s", "=", "self", ".", "get_storer", "(", "key", ")", "if", "s", "is", "None", ":", "return", "if", "not", "s", "....
Create a pytables index on the table Parameters ---------- key : object (the node to index) Exceptions ---------- raises if the node is not a table
[ "Create", "a", "pytables", "index", "on", "the", "table", "Parameters", "----------", "key", ":", "object", "(", "the", "node", "to", "index", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1057-L1078
train
pandas-dev/pandas
pandas/io/pytables.py
HDFStore.groups
def groups(self): """return a list of all the top-level nodes (that are not themselves a pandas storage object) """ _tables() self._check_if_open() return [ g for g in self._handle.walk_groups() if (not isinstance(g, _table_mod.link.Link) and ...
python
def groups(self): """return a list of all the top-level nodes (that are not themselves a pandas storage object) """ _tables() self._check_if_open() return [ g for g in self._handle.walk_groups() if (not isinstance(g, _table_mod.link.Link) and ...
[ "def", "groups", "(", "self", ")", ":", "_tables", "(", ")", "self", ".", "_check_if_open", "(", ")", "return", "[", "g", "for", "g", "in", "self", ".", "_handle", ".", "walk_groups", "(", ")", "if", "(", "not", "isinstance", "(", "g", ",", "_table...
return a list of all the top-level nodes (that are not themselves a pandas storage object)
[ "return", "a", "list", "of", "all", "the", "top", "-", "level", "nodes", "(", "that", "are", "not", "themselves", "a", "pandas", "storage", "object", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1080-L1093
train
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
train
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
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/io/pytables.py
HDFStore._validate_format
def _validate_format(self, format, kwargs): """ validate / deprecate formats; return the new kwargs """ kwargs = kwargs.copy() # validate try: kwargs['format'] = _FORMAT_MAP[format.lower()] except KeyError: raise TypeError("invalid HDFStore format specifi...
python
def _validate_format(self, format, kwargs): """ validate / deprecate formats; return the new kwargs """ kwargs = kwargs.copy() # validate try: kwargs['format'] = _FORMAT_MAP[format.lower()] except KeyError: raise TypeError("invalid HDFStore format specifi...
[ "def", "_validate_format", "(", "self", ",", "format", ",", "kwargs", ")", ":", "kwargs", "=", "kwargs", ".", "copy", "(", ")", "# validate", "try", ":", "kwargs", "[", "'format'", "]", "=", "_FORMAT_MAP", "[", "format", ".", "lower", "(", ")", "]", ...
validate / deprecate formats; return the new kwargs
[ "validate", "/", "deprecate", "formats", ";", "return", "the", "new", "kwargs" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1252-L1263
train
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
train
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
train
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
train
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
train
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.infer
def infer(self, handler): """infer this column from the table: create and return a new object""" table = handler.table new_self = self.copy() new_self.set_table(table) new_self.get_attr() new_self.read_metadata(handler) return new_self
python
def infer(self, handler): """infer this column from the table: create and return a new object""" table = handler.table new_self = self.copy() new_self.set_table(table) new_self.get_attr() new_self.read_metadata(handler) return new_self
[ "def", "infer", "(", "self", ",", "handler", ")", ":", "table", "=", "handler", ".", "table", "new_self", "=", "self", ".", "copy", "(", ")", "new_self", ".", "set_table", "(", "table", ")", "new_self", ".", "get_attr", "(", ")", "new_self", ".", "re...
infer this column from the table: create and return a new object
[ "infer", "this", "column", "from", "the", "table", ":", "create", "and", "return", "a", "new", "object" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1610-L1617
train
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.convert
def convert(self, values, nan_rep, encoding, errors): """ set the values from this selection: take = take ownership """ # values is a recarray if values.dtype.fields is not None: values = values[self.cname] values = _maybe_convert(values, self.kind, encoding, errors) ...
python
def convert(self, values, nan_rep, encoding, errors): """ set the values from this selection: take = take ownership """ # values is a recarray if values.dtype.fields is not None: values = values[self.cname] values = _maybe_convert(values, self.kind, encoding, errors) ...
[ "def", "convert", "(", "self", ",", "values", ",", "nan_rep", ",", "encoding", ",", "errors", ")", ":", "# values is a recarray", "if", "values", ".", "dtype", ".", "fields", "is", "not", "None", ":", "values", "=", "values", "[", "self", ".", "cname", ...
set the values from this selection: take = take ownership
[ "set", "the", "values", "from", "this", "selection", ":", "take", "=", "take", "ownership" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1619-L1646
train
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.maybe_set_size
def maybe_set_size(self, min_itemsize=None): """ maybe set a string col itemsize: min_itemsize can be an integer or a dict with this columns name with an integer size """ if _ensure_decoded(self.kind) == 'string': if isinstance(min_itemsize, dict): ...
python
def maybe_set_size(self, min_itemsize=None): """ maybe set a string col itemsize: min_itemsize can be an integer or a dict with this columns name with an integer size """ if _ensure_decoded(self.kind) == 'string': if isinstance(min_itemsize, dict): ...
[ "def", "maybe_set_size", "(", "self", ",", "min_itemsize", "=", "None", ")", ":", "if", "_ensure_decoded", "(", "self", ".", "kind", ")", "==", "'string'", ":", "if", "isinstance", "(", "min_itemsize", ",", "dict", ")", ":", "min_itemsize", "=", "min_items...
maybe set a string col itemsize: min_itemsize can be an integer or a dict with this columns name with an integer size
[ "maybe", "set", "a", "string", "col", "itemsize", ":", "min_itemsize", "can", "be", "an", "integer", "or", "a", "dict", "with", "this", "columns", "name", "with", "an", "integer", "size" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1674-L1685
train
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.validate_col
def validate_col(self, itemsize=None): """ validate this column: return the compared against itemsize """ # validate this column for string truncation (or reset to the max size) if _ensure_decoded(self.kind) == 'string': c = self.col if c is not None: if ...
python
def validate_col(self, itemsize=None): """ validate this column: return the compared against itemsize """ # validate this column for string truncation (or reset to the max size) if _ensure_decoded(self.kind) == 'string': c = self.col if c is not None: if ...
[ "def", "validate_col", "(", "self", ",", "itemsize", "=", "None", ")", ":", "# validate this column for string truncation (or reset to the max size)", "if", "_ensure_decoded", "(", "self", ".", "kind", ")", "==", "'string'", ":", "c", "=", "self", ".", "col", "if"...
validate this column: return the compared against itemsize
[ "validate", "this", "column", ":", "return", "the", "compared", "against", "itemsize" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1701-L1720
train
pandas-dev/pandas
pandas/io/pytables.py
IndexCol.update_info
def update_info(self, info): """ set/update the info for this indexable with the key/value if there is a conflict raise/warn as needed """ for key in self._info_fields: value = getattr(self, key, None) idx = _get_info(info, self.name) existing_value = i...
python
def update_info(self, info): """ set/update the info for this indexable with the key/value if there is a conflict raise/warn as needed """ for key in self._info_fields: value = getattr(self, key, None) idx = _get_info(info, self.name) existing_value = i...
[ "def", "update_info", "(", "self", ",", "info", ")", ":", "for", "key", "in", "self", ".", "_info_fields", ":", "value", "=", "getattr", "(", "self", ",", "key", ",", "None", ")", "idx", "=", "_get_info", "(", "info", ",", "self", ".", "name", ")",...
set/update the info for this indexable with the key/value if there is a conflict raise/warn as needed
[ "set", "/", "update", "the", "info", "for", "this", "indexable", "with", "the", "key", "/", "value", "if", "there", "is", "a", "conflict", "raise", "/", "warn", "as", "needed" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1732-L1764
train