partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _get_series_result_type | return appropriate class of Series concat
input is either dict or array-like | pandas/core/dtypes/concat.py | 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):
"""
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
... | [
"return",
"appropriate",
"class",
"of",
"Series",
"concat",
"input",
"is",
"either",
"dict",
"or",
"array",
"-",
"like"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L59-L79 | [
"def",
"_get_series_result_type",
"(",
"result",
",",
"objs",
"=",
"None",
")",
":",
"from",
"pandas",
"import",
"SparseSeries",
",",
"SparseDataFrame",
",",
"DataFrame",
"# concat Series with axis 1",
"if",
"isinstance",
"(",
"result",
",",
"dict",
")",
":",
"#... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _get_frame_result_type | return appropriate class of DataFrame-like concat
if all blocks are sparse, return SparseDataFrame
otherwise, return 1st obj | pandas/core/dtypes/concat.py | 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):
"""
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... | [
"return",
"appropriate",
"class",
"of",
"DataFrame",
"-",
"like",
"concat",
"if",
"all",
"blocks",
"are",
"sparse",
"return",
"SparseDataFrame",
"otherwise",
"return",
"1st",
"obj"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L82-L95 | [
"def",
"_get_frame_result_type",
"(",
"result",
",",
"objs",
")",
":",
"if",
"(",
"result",
".",
"blocks",
"and",
"(",
"any",
"(",
"isinstance",
"(",
"obj",
",",
"ABCSparseDataFrame",
")",
"for",
"obj",
"in",
"objs",
")",
")",
")",
":",
"from",
"pandas... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_compat | 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... | pandas/core/dtypes/concat.py | 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):
"""
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)
... | [
"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... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L98-L165 | [
"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... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_categorical | 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
-------
... | pandas/core/dtypes/concat.py | 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):
"""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... | [
"Concatenate",
"an",
"object",
"/",
"categorical",
"array",
"of",
"arrays",
"each",
"of",
"which",
"is",
"a",
"single",
"dtype"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L168-L206 | [
"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",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | union_categoricals | 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
... | pandas/core/dtypes/concat.py | 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):
"""
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,
... | [
"Combine",
"list",
"-",
"like",
"of",
"Categorical",
"-",
"like",
"unioning",
"categories",
".",
"All",
"categories",
"must",
"have",
"the",
"same",
"dtype",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L209-L381 | [
"def",
"union_categoricals",
"(",
"to_union",
",",
"sort_categories",
"=",
"False",
",",
"ignore_order",
"=",
"False",
")",
":",
"from",
"pandas",
"import",
"Index",
",",
"Categorical",
",",
"CategoricalIndex",
",",
"Series",
"from",
"pandas",
".",
"core",
"."... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_datetime | 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... | pandas/core/dtypes/concat.py | 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):
"""
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_... | [
"provide",
"concatenation",
"of",
"an",
"datetimelike",
"array",
"of",
"arrays",
"each",
"of",
"which",
"is",
"a",
"single",
"M8",
"[",
"ns",
"]",
"datetimet64",
"[",
"ns",
"tz",
"]",
"or",
"m8",
"[",
"ns",
"]",
"dtype"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L391-L435 | [
"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... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_datetimetz | concat DatetimeIndex with the same tz
all inputs must be DatetimeIndex
it is used in DatetimeIndex.append also | pandas/core/dtypes/concat.py | 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):
"""
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... | [
"concat",
"DatetimeIndex",
"with",
"the",
"same",
"tz",
"all",
"inputs",
"must",
"be",
"DatetimeIndex",
"it",
"is",
"used",
"in",
"DatetimeIndex",
".",
"append",
"also"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L459-L473 | [
"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",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_index_asobject | concat all inputs as object. DatetimeIndex, TimedeltaIndex and
PeriodIndex are converted to object dtype before concatenation | pandas/core/dtypes/concat.py | 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):
"""
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... | [
"concat",
"all",
"inputs",
"as",
"object",
".",
"DatetimeIndex",
"TimedeltaIndex",
"and",
"PeriodIndex",
"are",
"converted",
"to",
"object",
"dtype",
"before",
"concatenation"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L481-L501 | [
"def",
"_concat_index_asobject",
"(",
"to_concat",
",",
"name",
"=",
"None",
")",
":",
"from",
"pandas",
"import",
"Index",
"from",
"pandas",
".",
"core",
".",
"arrays",
"import",
"ExtensionArray",
"klasses",
"=",
"(",
"ABCDatetimeIndex",
",",
"ABCTimedeltaIndex... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_sparse | 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 | pandas/core/dtypes/concat.py | 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):
"""
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
-------
... | [
"provide",
"concatenation",
"of",
"an",
"sparse",
"/",
"dense",
"array",
"of",
"arrays",
"each",
"of",
"which",
"is",
"a",
"single",
"dtype"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L504-L531 | [
"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",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _concat_rangeindex_same_dtype | 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]) | pandas/core/dtypes/concat.py | 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):
"""
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... | [
"Concatenates",
"multiple",
"RangeIndex",
"instances",
".",
"All",
"members",
"of",
"indexes",
"must",
"be",
"of",
"type",
"RangeIndex",
";",
"result",
"will",
"be",
"RangeIndex",
"if",
"possible",
"Int64Index",
"otherwise",
".",
"E",
".",
"g",
".",
":",
"in... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L534-L578 | [
"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",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | rewrite_exception | Rewrite the message of an exception. | pandas/util/_exceptions.py | 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):
"""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
... | [
"Rewrite",
"the",
"message",
"of",
"an",
"exception",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_exceptions.py#L5-L16 | [
"def",
"rewrite_exception",
"(",
"old_name",
",",
"new_name",
")",
":",
"try",
":",
"yield",
"except",
"Exception",
"as",
"e",
":",
"msg",
"=",
"e",
".",
"args",
"[",
"0",
"]",
"msg",
"=",
"msg",
".",
"replace",
"(",
"old_name",
",",
"new_name",
")",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _get_level_lengths | 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 | pandas/io/formats/style.py | 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):
"""
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... | [
"Given",
"an",
"index",
"find",
"the",
"level",
"length",
"for",
"each",
"element",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1322-L1362 | [
"def",
"_get_level_lengths",
"(",
"index",
",",
"hidden_elements",
"=",
"None",
")",
":",
"sentinel",
"=",
"object",
"(",
")",
"levels",
"=",
"index",
".",
"format",
"(",
"sparsify",
"=",
"sentinel",
",",
"adjoin",
"=",
"False",
",",
"names",
"=",
"False... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler._translate | Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle}. | pandas/io/formats/style.py | 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):
"""
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... | [
"Convert",
"the",
"DataFrame",
"in",
"self",
".",
"data",
"and",
"the",
"attrs",
"from",
"_build_styles",
"into",
"a",
"dictionary",
"of",
"{",
"head",
"body",
"uuid",
"cellstyle",
"}",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L189-L354 | [
"def",
"_translate",
"(",
"self",
")",
":",
"table_styles",
"=",
"self",
".",
"table_styles",
"or",
"[",
"]",
"caption",
"=",
"self",
".",
"caption",
"ctx",
"=",
"self",
".",
"ctx",
"precision",
"=",
"self",
".",
"precision",
"hidden_index",
"=",
"self",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.format | 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
... | pandas/io/formats/style.py | 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):
"""
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... | [
"Format",
"the",
"text",
"display",
"value",
"of",
"cells",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L356-L419 | [
"def",
"format",
"(",
"self",
",",
"formatter",
",",
"subset",
"=",
"None",
")",
":",
"if",
"subset",
"is",
"None",
":",
"row_locs",
"=",
"range",
"(",
"len",
"(",
"self",
".",
"data",
")",
")",
"col_locs",
"=",
"range",
"(",
"len",
"(",
"self",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.render | 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.
..... | pandas/io/formats/style.py | 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):
"""
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 ... | [
"Render",
"the",
"built",
"up",
"styles",
"to",
"HTML",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L421-L471 | [
"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... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler._update_ctx | 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. | pandas/io/formats/style.py | 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):
"""
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... | [
"Update",
"the",
"state",
"of",
"the",
"Styler",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L473-L489 | [
"def",
"_update_ctx",
"(",
"self",
",",
"attrs",
")",
":",
"for",
"row_label",
",",
"v",
"in",
"attrs",
".",
"iterrows",
"(",
")",
":",
"for",
"col_label",
",",
"col",
"in",
"v",
".",
"iteritems",
"(",
")",
":",
"i",
"=",
"self",
".",
"index",
".... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler._compute | 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) | pandas/io/formats/style.py | 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):
"""
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... | [
"Execute",
"the",
"style",
"functions",
"built",
"up",
"in",
"self",
".",
"_todo",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L520-L532 | [
"def",
"_compute",
"(",
"self",
")",
":",
"r",
"=",
"self",
"for",
"func",
",",
"args",
",",
"kwargs",
"in",
"self",
".",
"_todo",
":",
"r",
"=",
"func",
"(",
"self",
")",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"r"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.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.
... | pandas/io/formats/style.py | 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):
"""
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
... | [
"Apply",
"a",
"function",
"column",
"-",
"wise",
"row",
"-",
"wise",
"or",
"table",
"-",
"wise",
"updating",
"the",
"HTML",
"representation",
"with",
"the",
"result",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L567-L614 | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"axis",
"=",
"0",
",",
"subset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_todo",
".",
"append",
"(",
"(",
"lambda",
"instance",
":",
"getattr",
"(",
"instance",
",",
"'_apply'",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.applymap | 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
... | pandas/io/formats/style.py | 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):
"""
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
... | [
"Apply",
"a",
"function",
"elementwise",
"updating",
"the",
"HTML",
"representation",
"with",
"the",
"result",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L625-L650 | [
"def",
"applymap",
"(",
"self",
",",
"func",
",",
"subset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_todo",
".",
"append",
"(",
"(",
"lambda",
"instance",
":",
"getattr",
"(",
"instance",
",",
"'_applymap'",
")",
",",
"(",
"fu... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.where | 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... | pandas/io/formats/style.py | 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):
"""
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
----------
... | [
"Apply",
"a",
"function",
"elementwise",
"updating",
"the",
"HTML",
"representation",
"with",
"a",
"style",
"which",
"is",
"selected",
"in",
"accordance",
"with",
"the",
"return",
"value",
"of",
"a",
"function",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L652-L687 | [
"def",
"where",
"(",
"self",
",",
"cond",
",",
"value",
",",
"other",
"=",
"None",
",",
"subset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"other",
"is",
"None",
":",
"other",
"=",
"''",
"return",
"self",
".",
"applymap",
"(",
"lambd... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.hide_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 | pandas/io/formats/style.py | 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):
"""
Hide columns from rendering.
.. versionadded:: 0.23.0
Parameters
----------
subset : IndexSlice
An argument to ``DataFrame.loc`` that identifies which columns
are hidden.
Returns
-------
... | [
"Hide",
"columns",
"from",
"rendering",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L838-L857 | [
"def",
"hide_columns",
"(",
"self",
",",
"subset",
")",
":",
"subset",
"=",
"_non_reducing_slice",
"(",
"subset",
")",
"hidden_df",
"=",
"self",
".",
"data",
".",
"loc",
"[",
"subset",
"]",
"self",
".",
"hidden_columns",
"=",
"self",
".",
"columns",
".",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.highlight_null | Shade the background ``null_color`` for missing values.
Parameters
----------
null_color : str
Returns
-------
self : Styler | pandas/io/formats/style.py | 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'):
"""
Shade the background ``null_color`` for missing values.
Parameters
----------
null_color : str
Returns
-------
self : Styler
"""
self.applymap(self._highlight_null, null_color=null_color)
... | [
"Shade",
"the",
"background",
"null_color",
"for",
"missing",
"values",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L868-L881 | [
"def",
"highlight_null",
"(",
"self",
",",
"null_color",
"=",
"'red'",
")",
":",
"self",
".",
"applymap",
"(",
"self",
".",
"_highlight_null",
",",
"null_color",
"=",
"null_color",
")",
"return",
"self"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.background_gradient | 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 : {... | pandas/io/formats/style.py | 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):
"""
Color the background in a gradient according to
the data in each column (optionally row).
Requires matplotlib.
Parameters
--------... | [
"Color",
"the",
"background",
"in",
"a",
"gradient",
"according",
"to",
"the",
"data",
"in",
"each",
"column",
"(",
"optionally",
"row",
")",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L883-L931 | [
"def",
"background_gradient",
"(",
"self",
",",
"cmap",
"=",
"'PuBu'",
",",
"low",
"=",
"0",
",",
"high",
"=",
"0",
",",
"axis",
"=",
"0",
",",
"subset",
"=",
"None",
",",
"text_color_threshold",
"=",
"0.408",
")",
":",
"subset",
"=",
"_maybe_numeric_s... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler._background_gradient | Color background in a range according to the data. | pandas/io/formats/style.py | 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):
"""
Color background in a range according to the data.
"""
if (not isinstance(text_color_threshold, (float, int)) or
not 0 <= text_color_threshold <= 1):
... | [
"Color",
"background",
"in",
"a",
"range",
"according",
"to",
"the",
"data",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L934-L989 | [
"def",
"_background_gradient",
"(",
"s",
",",
"cmap",
"=",
"'PuBu'",
",",
"low",
"=",
"0",
",",
"high",
"=",
"0",
",",
"text_color_threshold",
"=",
"0.408",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"text_color_threshold",
",",
"(",
"float",
",",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.set_properties | 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
... | pandas/io/formats/style.py | 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):
"""
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 :... | [
"Convenience",
"method",
"for",
"setting",
"one",
"or",
"more",
"non",
"-",
"data",
"dependent",
"properties",
"or",
"each",
"cell",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L991-L1016 | [
"def",
"set_properties",
"(",
"self",
",",
"subset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"values",
"=",
"';'",
".",
"join",
"(",
"'{p}: {v}'",
".",
"format",
"(",
"p",
"=",
"p",
",",
"v",
"=",
"v",
")",
"for",
"p",
",",
"v",
"in",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler._bar | Draw bar chart in dataframe cells. | pandas/io/formats/style.py | 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):
"""
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... | [
"Draw",
"bar",
"chart",
"in",
"dataframe",
"cells",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1019-L1075 | [
"def",
"_bar",
"(",
"s",
",",
"align",
",",
"colors",
",",
"width",
"=",
"100",
",",
"vmin",
"=",
"None",
",",
"vmax",
"=",
"None",
")",
":",
"# Get input value range.",
"smin",
"=",
"s",
".",
"min",
"(",
")",
"if",
"vmin",
"is",
"None",
"else",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.bar | 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... | pandas/io/formats/style.py | 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):
"""
Draw bar chart in the cell backgrounds.
Parameters
----------
subset : IndexSlice, optional
A valid slice for `data` to limit the style application to.... | [
"Draw",
"bar",
"chart",
"in",
"the",
"cell",
"backgrounds",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1077-L1145 | [
"def",
"bar",
"(",
"self",
",",
"subset",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"color",
"=",
"'#d65f5f'",
",",
"width",
"=",
"100",
",",
"align",
"=",
"'left'",
",",
"vmin",
"=",
"None",
",",
"vmax",
"=",
"None",
")",
":",
"if",
"align",
"n... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.highlight_max | 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... | pandas/io/formats/style.py | 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):
"""
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... | [
"Highlight",
"the",
"maximum",
"by",
"shading",
"the",
"background",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1147-L1166 | [
"def",
"highlight_max",
"(",
"self",
",",
"subset",
"=",
"None",
",",
"color",
"=",
"'yellow'",
",",
"axis",
"=",
"0",
")",
":",
"return",
"self",
".",
"_highlight_handler",
"(",
"subset",
"=",
"subset",
",",
"color",
"=",
"color",
",",
"axis",
"=",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.highlight_min | 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... | pandas/io/formats/style.py | 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):
"""
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... | [
"Highlight",
"the",
"minimum",
"by",
"shading",
"the",
"background",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1168-L1187 | [
"def",
"highlight_min",
"(",
"self",
",",
"subset",
"=",
"None",
",",
"color",
"=",
"'yellow'",
",",
"axis",
"=",
"0",
")",
":",
"return",
"self",
".",
"_highlight_handler",
"(",
"subset",
"=",
"subset",
",",
"color",
"=",
"color",
",",
"axis",
"=",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler._highlight_extrema | Highlight the min or max in a Series or DataFrame. | pandas/io/formats/style.py | 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):
"""
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()
... | [
"Highlight",
"the",
"min",
"or",
"max",
"in",
"a",
"Series",
"or",
"DataFrame",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1197-L1214 | [
"def",
"_highlight_extrema",
"(",
"data",
",",
"color",
"=",
"'yellow'",
",",
"max_",
"=",
"True",
")",
":",
"attr",
"=",
"'background-color: {0}'",
".",
"format",
"(",
"color",
")",
"if",
"data",
".",
"ndim",
"==",
"1",
":",
"# Series from .apply",
"if",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Styler.from_custom_template | 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... | pandas/io/formats/style.py | 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):
"""
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
... | [
"Factory",
"function",
"for",
"creating",
"a",
"subclass",
"of",
"Styler",
"with",
"a",
"custom",
"template",
"and",
"Jinja",
"environment",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1217-L1243 | [
"def",
"from_custom_template",
"(",
"cls",
",",
"searchpath",
",",
"name",
")",
":",
"loader",
"=",
"ChoiceLoader",
"(",
"[",
"FileSystemLoader",
"(",
"searchpath",
")",
",",
"cls",
".",
"loader",
",",
"]",
")",
"class",
"MyStyler",
"(",
"cls",
")",
":",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Registry.register | Parameters
----------
dtype : ExtensionDtype | pandas/core/dtypes/dtypes.py | 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):
"""
Parameters
----------
dtype : ExtensionDtype
"""
if not issubclass(dtype, (PandasExtensionDtype, ExtensionDtype)):
raise ValueError("can only register pandas extension dtypes")
self.dtypes.append(dtype) | [
"Parameters",
"----------",
"dtype",
":",
"ExtensionDtype"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/dtypes.py#L60-L69 | [
"def",
"register",
"(",
"self",
",",
"dtype",
")",
":",
"if",
"not",
"issubclass",
"(",
"dtype",
",",
"(",
"PandasExtensionDtype",
",",
"ExtensionDtype",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"can only register pandas extension dtypes\"",
")",
"self",
"."... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Registry.find | Parameters
----------
dtype : PandasExtensionDtype or string
Returns
-------
return the first matching dtype, otherwise return None | pandas/core/dtypes/dtypes.py | 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):
"""
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... | [
"Parameters",
"----------",
"dtype",
":",
"PandasExtensionDtype",
"or",
"string"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/dtypes.py#L71-L96 | [
"def",
"find",
"(",
"self",
",",
"dtype",
")",
":",
"if",
"not",
"isinstance",
"(",
"dtype",
",",
"str",
")",
":",
"dtype_type",
"=",
"dtype",
"if",
"not",
"isinstance",
"(",
"dtype",
",",
"type",
")",
":",
"dtype_type",
"=",
"type",
"(",
"dtype",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | np_datetime64_compat | 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' | pandas/compat/numpy/__init__.py | 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):
"""
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... | [
"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",
... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/__init__.py#L37-L44 | [
"def",
"np_datetime64_compat",
"(",
"s",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"tz_replacer",
"(",
"s",
")",
"return",
"np",
".",
"datetime64",
"(",
"s",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | np_array_datetime64_compat | 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' | pandas/compat/numpy/__init__.py | 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):
"""
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... | [
"provide",
"compat",
"for",
"construction",
"of",
"an",
"array",
"of",
"strings",
"to",
"a",
"np",
".",
"array",
"(",
"...",
"dtype",
"=",
"np",
".",
"datetime64",
"(",
"..",
"))",
"tz",
"-",
"changes",
"in",
"1",
".",
"11",
"that",
"make",
"2015",
... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/__init__.py#L47-L60 | [
"def",
"np_array_datetime64_compat",
"(",
"arr",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# is_list_like",
"if",
"(",
"hasattr",
"(",
"arr",
",",
"'__iter__'",
")",
"and",
"not",
"isinstance",
"(",
"arr",
",",
"(",
"str",
",",
"bytes",
")"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Int64Index._assert_safe_casting | Ensure incoming data can be represented as ints. | pandas/core/indexes/numeric.py | 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):
"""
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 '
... | [
"Ensure",
"incoming",
"data",
"can",
"be",
"represented",
"as",
"ints",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/numeric.py#L215-L222 | [
"def",
"_assert_safe_casting",
"(",
"cls",
",",
"data",
",",
"subarr",
")",
":",
"if",
"not",
"issubclass",
"(",
"data",
".",
"dtype",
".",
"type",
",",
"np",
".",
"signedinteger",
")",
":",
"if",
"not",
"np",
".",
"array_equal",
"(",
"data",
",",
"s... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Float64Index.get_value | we always want to get an index value, never a value | pandas/core/indexes/numeric.py | 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):
""" 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... | [
"we",
"always",
"want",
"to",
"get",
"an",
"index",
"value",
"never",
"a",
"value"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/numeric.py#L364-L373 | [
"def",
"get_value",
"(",
"self",
",",
"series",
",",
"key",
")",
":",
"if",
"not",
"is_scalar",
"(",
"key",
")",
":",
"raise",
"InvalidIndexError",
"k",
"=",
"com",
".",
"values_from_object",
"(",
"key",
")",
"loc",
"=",
"self",
".",
"get_loc",
"(",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Float64Index.equals | Determines if two Index objects contain the same elements. | pandas/core/indexes/numeric.py | 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):
"""
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
... | [
"Determines",
"if",
"two",
"Index",
"objects",
"contain",
"the",
"same",
"elements",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/numeric.py#L375-L396 | [
"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",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _ensure_decoded | if we have bytes, decode them to unicode | pandas/io/pytables.py | 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 we have bytes, decode them to unicode """
if isinstance(s, np.bytes_):
s = s.decode('UTF-8')
return s | [
"if",
"we",
"have",
"bytes",
"decode",
"them",
"to",
"unicode"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L51-L55 | [
"def",
"_ensure_decoded",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"np",
".",
"bytes_",
")",
":",
"s",
"=",
"s",
".",
"decode",
"(",
"'UTF-8'",
")",
"return",
"s"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _ensure_term | 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) | pandas/io/pytables.py | 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):
"""
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... | [
"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",
... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L81-L102 | [
"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",
")",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | to_hdf | store this object, close it if we opened it | pandas/io/pytables.py | 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):
""" 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... | [
"store",
"this",
"object",
"close",
"it",
"if",
"we",
"opened",
"it"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L248-L263 | [
"def",
"to_hdf",
"(",
"path_or_buf",
",",
"key",
",",
"value",
",",
"mode",
"=",
"None",
",",
"complevel",
"=",
"None",
",",
"complib",
"=",
"None",
",",
"append",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"append",
":",
"f",
"=",
"la... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | read_hdf | 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... | pandas/io/pytables.py | 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):
"""
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... | [
"Read",
"from",
"the",
"store",
"close",
"it",
"if",
"we",
"opened",
"it",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L266-L384 | [
"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... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _is_metadata_of | Check if a given group is a metadata group for a given parent_group. | pandas/io/pytables.py | 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):
"""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... | [
"Check",
"if",
"a",
"given",
"group",
"is",
"a",
"metadata",
"group",
"for",
"a",
"given",
"parent_group",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L387-L398 | [
"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",
"="... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _get_info | get/create the info for this name | pandas/io/pytables.py | 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):
""" get/create the info for this name """
try:
idx = info[name]
except KeyError:
idx = info[name] = dict()
return idx | [
"get",
"/",
"create",
"the",
"info",
"for",
"this",
"name"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4345-L4351 | [
"def",
"_get_info",
"(",
"info",
",",
"name",
")",
":",
"try",
":",
"idx",
"=",
"info",
"[",
"name",
"]",
"except",
"KeyError",
":",
"idx",
"=",
"info",
"[",
"name",
"]",
"=",
"dict",
"(",
")",
"return",
"idx"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _get_tz | for a tz-aware type, return an encoded zone | pandas/io/pytables.py | 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):
""" 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 | [
"for",
"a",
"tz",
"-",
"aware",
"type",
"return",
"an",
"encoded",
"zone"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4356-L4361 | [
"def",
"_get_tz",
"(",
"tz",
")",
":",
"zone",
"=",
"timezones",
".",
"get_timezone",
"(",
"tz",
")",
"if",
"zone",
"is",
"None",
":",
"zone",
"=",
"tz",
".",
"utcoffset",
"(",
")",
".",
"total_seconds",
"(",
")",
"return",
"zone"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _set_tz | 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 | pandas/io/pytables.py | 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):
"""
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... | [
"coerce",
"the",
"values",
"to",
"a",
"DatetimeIndex",
"if",
"tz",
"is",
"set",
"preserve",
"the",
"input",
"shape",
"if",
"possible"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4364-L4390 | [
"def",
"_set_tz",
"(",
"values",
",",
"tz",
",",
"preserve_UTC",
"=",
"False",
",",
"coerce",
"=",
"False",
")",
":",
"if",
"tz",
"is",
"not",
"None",
":",
"name",
"=",
"getattr",
"(",
"values",
",",
"'name'",
",",
"None",
")",
"values",
"=",
"valu... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _convert_string_array | 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... | pandas/io/pytables.py | 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):
"""
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
... | [
"we",
"take",
"a",
"string",
"-",
"like",
"that",
"is",
"object",
"dtype",
"and",
"coerce",
"to",
"a",
"fixed",
"size",
"string",
"type"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4521-L4549 | [
"def",
"_convert_string_array",
"(",
"data",
",",
"encoding",
",",
"errors",
",",
"itemsize",
"=",
"None",
")",
":",
"# encode if needed",
"if",
"encoding",
"is",
"not",
"None",
"and",
"len",
"(",
"data",
")",
":",
"data",
"=",
"Series",
"(",
"data",
"."... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _unconvert_string_array | 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... | pandas/io/pytables.py | 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'):
"""
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... | [
"inverse",
"of",
"_convert_string_array"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4552-L4589 | [
"def",
"_unconvert_string_array",
"(",
"data",
",",
"nan_rep",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"shape",
"=",
"data",
".",
"shape",
"data",
"=",
"np",
".",
"asarray",
"(",
"data",
".",
"ravel",
"(",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.open | 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 | pandas/io/pytables.py | 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):
"""
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 !... | [
"Open",
"the",
"file",
"in",
"the",
"specified",
"mode"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L553-L624 | [
"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",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.flush | 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
... | pandas/io/pytables.py | 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):
"""
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... | [
"Force",
"all",
"buffered",
"modifications",
"to",
"be",
"written",
"to",
"disk",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L643-L665 | [
"def",
"flush",
"(",
"self",
",",
"fsync",
"=",
"False",
")",
":",
"if",
"self",
".",
"_handle",
"is",
"not",
"None",
":",
"self",
".",
"_handle",
".",
"flush",
"(",
")",
"if",
"fsync",
":",
"try",
":",
"os",
".",
"fsync",
"(",
"self",
".",
"_h... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.get | Retrieve pandas object stored in file
Parameters
----------
key : object
Returns
-------
obj : same type as object stored in file | pandas/io/pytables.py | 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):
"""
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(... | [
"Retrieve",
"pandas",
"object",
"stored",
"in",
"file"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L667-L682 | [
"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",
")",
")",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.select | 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... | pandas/io/pytables.py | 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, **kwargs):
"""
Retrieve pandas object stored in file, optionally based on where
criteria
Parameters
----------
key : object
whe... | [
"Retrieve",
"pandas",
"object",
"stored",
"in",
"file",
"optionally",
"based",
"on",
"where",
"criteria"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L684-L727 | [
"def",
"select",
"(",
"self",
",",
"key",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"iterator",
"=",
"False",
",",
"chunksize",
"=",
"None",
",",
"auto_close",
"=",
"False",
",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.select_as_coordinates | 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 | pandas/io/pytables.py | 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):
"""
return the selection as an Index
Parameters
----------
key : object
where : list of Term (or convertible) objects, optional
start : integer (defaults to None), row... | [
"return",
"the",
"selection",
"as",
"an",
"Index"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L729-L743 | [
"def",
"select_as_coordinates",
"(",
"self",
",",
"key",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"where",
"=",
"_ensure_term",
"(",
"where",
",",
"scope_level",
"=",
"1",
")",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.select_column | 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
... | pandas/io/pytables.py | 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 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... | [
"return",
"a",
"single",
"column",
"from",
"the",
"table",
".",
"This",
"is",
"generally",
"only",
"useful",
"to",
"select",
"an",
"indexable"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L745-L763 | [
"def",
"select_column",
"(",
"self",
",",
"key",
",",
"column",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"get_storer",
"(",
"key",
")",
".",
"read_column",
"(",
"column",
"=",
"column",
",",
"*",
"*",
"kwargs",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.select_as_multiple | 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... | pandas/io/pytables.py | 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=None, auto_close=False, **kwargs):
""" Retrieve pandas objects from multiple tables
Parameters
----------
ke... | [
"Retrieve",
"pandas",
"objects",
"from",
"multiple",
"tables"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L765-L846 | [
"def",
"select_as_multiple",
"(",
"self",
",",
"keys",
",",
"where",
"=",
"None",
",",
"selector",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"iterator",
"=",
"False",
",",
"chunksize",
"=",
"N... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.put | 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)... | pandas/io/pytables.py | 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):
"""
Store object in HDFStore
Parameters
----------
key : object
value : {Series, DataFrame}
format : 'fixed(f)|table(t)', default is 'fixed'
fixed(f) : Fixed format
... | [
"Store",
"object",
"in",
"HDFStore"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L848-L876 | [
"def",
"put",
"(",
"self",
",",
"key",
",",
"value",
",",
"format",
"=",
"None",
",",
"append",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"format",
"is",
"None",
":",
"format",
"=",
"get_option",
"(",
"\"io.hdf.default_format\"",
")",
"o... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.remove | 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... | pandas/io/pytables.py | 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):
"""
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
... | [
"Remove",
"pandas",
"object",
"partially",
"by",
"specifying",
"the",
"where",
"condition"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L878-L926 | [
"def",
"remove",
"(",
"self",
",",
"key",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"where",
"=",
"_ensure_term",
"(",
"where",
",",
"scope_level",
"=",
"1",
")",
"try",
":",
"s",
"=",
"self",
".",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.append | 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... | pandas/io/pytables.py | 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):
"""
Append to Table in file. Node must already exist and be Table
format.
Parameters
----------
key : object
value : {Series, DataFrame}
format : '... | [
"Append",
"to",
"Table",
"in",
"file",
".",
"Node",
"must",
"already",
"exist",
"and",
"be",
"Table",
"format",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L928-L973 | [
"def",
"append",
"(",
"self",
",",
"key",
",",
"value",
",",
"format",
"=",
"None",
",",
"append",
"=",
"True",
",",
"columns",
"=",
"None",
",",
"dropna",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"columns",
"is",
"not",
"None",
":",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.append_to_multiple | 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... | pandas/io/pytables.py | 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):
"""
Append to multiple tables
Parameters
----------
d : a dict of table_name to table_columns, None is acceptable as the
values of one n... | [
"Append",
"to",
"multiple",
"tables"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L975-L1055 | [
"def",
"append_to_multiple",
"(",
"self",
",",
"d",
",",
"value",
",",
"selector",
",",
"data_columns",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"dropna",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"axes",
"is",
"not",
"None",
":",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.create_table_index | Create a pytables index on the table
Parameters
----------
key : object (the node to index)
Exceptions
----------
raises if the node is not a table | pandas/io/pytables.py | 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):
""" 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()
... | [
"Create",
"a",
"pytables",
"index",
"on",
"the",
"table",
"Parameters",
"----------",
"key",
":",
"object",
"(",
"the",
"node",
"to",
"index",
")"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1057-L1078 | [
"def",
"create_table_index",
"(",
"self",
",",
"key",
",",
"*",
"*",
"kwargs",
")",
":",
"# version requirements",
"_tables",
"(",
")",
"s",
"=",
"self",
".",
"get_storer",
"(",
"key",
")",
"if",
"s",
"is",
"None",
":",
"return",
"if",
"not",
"s",
".... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.groups | return a list of all the top-level nodes (that are not themselves a
pandas storage object) | pandas/io/pytables.py | 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):
"""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
... | [
"return",
"a",
"list",
"of",
"all",
"the",
"top",
"-",
"level",
"nodes",
"(",
"that",
"are",
"not",
"themselves",
"a",
"pandas",
"storage",
"object",
")"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1080-L1093 | [
"def",
"groups",
"(",
"self",
")",
":",
"_tables",
"(",
")",
"self",
".",
"_check_if_open",
"(",
")",
"return",
"[",
"g",
"for",
"g",
"in",
"self",
".",
"_handle",
".",
"walk_groups",
"(",
")",
"if",
"(",
"not",
"isinstance",
"(",
"g",
",",
"_table... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.walk | 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
... | pandas/io/pytables.py | 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="/"):
""" 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... | [
"Walk",
"the",
"pytables",
"group",
"hierarchy",
"for",
"pandas",
"objects"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1095-L1139 | [
"def",
"walk",
"(",
"self",
",",
"where",
"=",
"\"/\"",
")",
":",
"_tables",
"(",
")",
"self",
".",
"_check_if_open",
"(",
")",
"for",
"g",
"in",
"self",
".",
"_handle",
".",
"walk_groups",
"(",
"where",
")",
":",
"if",
"getattr",
"(",
"g",
".",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.get_node | return the node with the key or None if it does not exist | pandas/io/pytables.py | 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):
""" 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... | [
"return",
"the",
"node",
"with",
"the",
"key",
"or",
"None",
"if",
"it",
"does",
"not",
"exist"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1141-L1149 | [
"def",
"get_node",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_check_if_open",
"(",
")",
"try",
":",
"if",
"not",
"key",
".",
"startswith",
"(",
"'/'",
")",
":",
"key",
"=",
"'/'",
"+",
"key",
"return",
"self",
".",
"_handle",
".",
"get_node"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.get_storer | return the storer object for a key, raise if not in the file | pandas/io/pytables.py | 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):
""" 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... | [
"return",
"the",
"storer",
"object",
"for",
"a",
"key",
"raise",
"if",
"not",
"in",
"the",
"file"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1151-L1159 | [
"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",
")",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.copy | 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... | pandas/io/pytables.py | 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... | [
"copy",
"the",
"existing",
"store",
"to",
"a",
"new",
"file",
"upgrading",
"in",
"place"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1161-L1210 | [
"def",
"copy",
"(",
"self",
",",
"file",
",",
"mode",
"=",
"'w'",
",",
"propindexes",
"=",
"True",
",",
"keys",
"=",
"None",
",",
"complib",
"=",
"None",
",",
"complevel",
"=",
"None",
",",
"fletcher32",
"=",
"False",
",",
"overwrite",
"=",
"True",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore.info | Print detailed information on the store.
.. versionadded:: 0.21.0 | pandas/io/pytables.py | 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):
"""
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()))
... | [
"Print",
"detailed",
"information",
"on",
"the",
"store",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1212-L1245 | [
"def",
"info",
"(",
"self",
")",
":",
"output",
"=",
"'{type}\\nFile path: {path}\\n'",
".",
"format",
"(",
"type",
"=",
"type",
"(",
"self",
")",
",",
"path",
"=",
"pprint_thing",
"(",
"self",
".",
"_path",
")",
")",
"if",
"self",
".",
"is_open",
":",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore._validate_format | validate / deprecate formats; return the new kwargs | pandas/io/pytables.py | 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):
""" 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... | [
"validate",
"/",
"deprecate",
"formats",
";",
"return",
"the",
"new",
"kwargs"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1252-L1263 | [
"def",
"_validate_format",
"(",
"self",
",",
"format",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"kwargs",
".",
"copy",
"(",
")",
"# validate",
"try",
":",
"kwargs",
"[",
"'format'",
"]",
"=",
"_FORMAT_MAP",
"[",
"format",
".",
"lower",
"(",
")",
"]",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | HDFStore._create_storer | return a suitable class to operate | pandas/io/pytables.py | 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):
""" return a suitable class to operate """
def error(t):
raise TypeError(
"cannot properly create the storer for: [{t}] [group->"
"{group},value->{value},... | [
"return",
"a",
"suitable",
"class",
"to",
"operate"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1265-L1350 | [
"def",
"_create_storer",
"(",
"self",
",",
"group",
",",
"format",
"=",
"None",
",",
"value",
"=",
"None",
",",
"append",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"error",
"(",
"t",
")",
":",
"raise",
"TypeError",
"(",
"\"cannot proper... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.set_name | set the name of this indexer | pandas/io/pytables.py | 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):
""" 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 | [
"set",
"the",
"name",
"of",
"this",
"indexer"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1552-L1559 | [
"def",
"set_name",
"(",
"self",
",",
"name",
",",
"kind_attr",
"=",
"None",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"kind_attr",
"=",
"kind_attr",
"or",
"\"{name}_kind\"",
".",
"format",
"(",
"name",
"=",
"name",
")",
"if",
"self",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.set_pos | set the position of this column in the Table | pandas/io/pytables.py | 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):
""" 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 | [
"set",
"the",
"position",
"of",
"this",
"column",
"in",
"the",
"Table"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1567-L1572 | [
"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"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.is_indexed | return whether I am an indexed column | pandas/io/pytables.py | 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):
""" return whether I am an indexed column """
try:
return getattr(self.table.cols, self.cname).is_indexed
except AttributeError:
False | [
"return",
"whether",
"I",
"am",
"an",
"indexed",
"column"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1599-L1604 | [
"def",
"is_indexed",
"(",
"self",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
".",
"table",
".",
"cols",
",",
"self",
".",
"cname",
")",
".",
"is_indexed",
"except",
"AttributeError",
":",
"False"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.infer | infer this column from the table: create and return a new object | pandas/io/pytables.py | 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):
"""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 | [
"infer",
"this",
"column",
"from",
"the",
"table",
":",
"create",
"and",
"return",
"a",
"new",
"object"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1610-L1617 | [
"def",
"infer",
"(",
"self",
",",
"handler",
")",
":",
"table",
"=",
"handler",
".",
"table",
"new_self",
"=",
"self",
".",
"copy",
"(",
")",
"new_self",
".",
"set_table",
"(",
"table",
")",
"new_self",
".",
"get_attr",
"(",
")",
"new_self",
".",
"re... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.convert | set the values from this selection: take = take ownership | pandas/io/pytables.py | 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):
""" 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)
... | [
"set",
"the",
"values",
"from",
"this",
"selection",
":",
"take",
"=",
"take",
"ownership"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1619-L1646 | [
"def",
"convert",
"(",
"self",
",",
"values",
",",
"nan_rep",
",",
"encoding",
",",
"errors",
")",
":",
"# values is a recarray",
"if",
"values",
".",
"dtype",
".",
"fields",
"is",
"not",
"None",
":",
"values",
"=",
"values",
"[",
"self",
".",
"cname",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.maybe_set_size | maybe set a string col itemsize:
min_itemsize can be an integer or a dict with this columns name
with an integer size | pandas/io/pytables.py | 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):
""" 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):
... | [
"maybe",
"set",
"a",
"string",
"col",
"itemsize",
":",
"min_itemsize",
"can",
"be",
"an",
"integer",
"or",
"a",
"dict",
"with",
"this",
"columns",
"name",
"with",
"an",
"integer",
"size"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1674-L1685 | [
"def",
"maybe_set_size",
"(",
"self",
",",
"min_itemsize",
"=",
"None",
")",
":",
"if",
"_ensure_decoded",
"(",
"self",
".",
"kind",
")",
"==",
"'string'",
":",
"if",
"isinstance",
"(",
"min_itemsize",
",",
"dict",
")",
":",
"min_itemsize",
"=",
"min_items... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.validate_col | validate this column: return the compared against itemsize | pandas/io/pytables.py | 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: 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 ... | [
"validate",
"this",
"column",
":",
"return",
"the",
"compared",
"against",
"itemsize"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1701-L1720 | [
"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"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.update_info | set/update the info for this indexable with the key/value
if there is a conflict raise/warn as needed | pandas/io/pytables.py | 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):
""" 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... | [
"set",
"/",
"update",
"the",
"info",
"for",
"this",
"indexable",
"with",
"the",
"key",
"/",
"value",
"if",
"there",
"is",
"a",
"conflict",
"raise",
"/",
"warn",
"as",
"needed"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1732-L1764 | [
"def",
"update_info",
"(",
"self",
",",
"info",
")",
":",
"for",
"key",
"in",
"self",
".",
"_info_fields",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"key",
",",
"None",
")",
"idx",
"=",
"_get_info",
"(",
"info",
",",
"self",
".",
"name",
")",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.set_info | set my state from the passed info | pandas/io/pytables.py | def set_info(self, info):
""" set my state from the passed info """
idx = info.get(self.name)
if idx is not None:
self.__dict__.update(idx) | def set_info(self, info):
""" set my state from the passed info """
idx = info.get(self.name)
if idx is not None:
self.__dict__.update(idx) | [
"set",
"my",
"state",
"from",
"the",
"passed",
"info"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1766-L1770 | [
"def",
"set_info",
"(",
"self",
",",
"info",
")",
":",
"idx",
"=",
"info",
".",
"get",
"(",
"self",
".",
"name",
")",
"if",
"idx",
"is",
"not",
"None",
":",
"self",
".",
"__dict__",
".",
"update",
"(",
"idx",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.validate_metadata | validate that kind=category does not change the categories | pandas/io/pytables.py | def validate_metadata(self, handler):
""" validate that kind=category does not change the categories """
if self.meta == 'category':
new_metadata = self.metadata
cur_metadata = handler.read_metadata(self.cname)
if (new_metadata is not None and cur_metadata is not None... | def validate_metadata(self, handler):
""" validate that kind=category does not change the categories """
if self.meta == 'category':
new_metadata = self.metadata
cur_metadata = handler.read_metadata(self.cname)
if (new_metadata is not None and cur_metadata is not None... | [
"validate",
"that",
"kind",
"=",
"category",
"does",
"not",
"change",
"the",
"categories"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1784-L1792 | [
"def",
"validate_metadata",
"(",
"self",
",",
"handler",
")",
":",
"if",
"self",
".",
"meta",
"==",
"'category'",
":",
"new_metadata",
"=",
"self",
".",
"metadata",
"cur_metadata",
"=",
"handler",
".",
"read_metadata",
"(",
"self",
".",
"cname",
")",
"if",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | IndexCol.write_metadata | set the meta data | pandas/io/pytables.py | def write_metadata(self, handler):
""" set the meta data """
if self.metadata is not None:
handler.write_metadata(self.cname, self.metadata) | def write_metadata(self, handler):
""" set the meta data """
if self.metadata is not None:
handler.write_metadata(self.cname, self.metadata) | [
"set",
"the",
"meta",
"data"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1794-L1797 | [
"def",
"write_metadata",
"(",
"self",
",",
"handler",
")",
":",
"if",
"self",
".",
"metadata",
"is",
"not",
"None",
":",
"handler",
".",
"write_metadata",
"(",
"self",
".",
"cname",
",",
"self",
".",
"metadata",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericIndexCol.convert | set the values from this selection: take = take ownership | pandas/io/pytables.py | def convert(self, values, nan_rep, encoding, errors):
""" set the values from this selection: take = take ownership """
self.values = Int64Index(np.arange(self.table.nrows))
return self | def convert(self, values, nan_rep, encoding, errors):
""" set the values from this selection: take = take ownership """
self.values = Int64Index(np.arange(self.table.nrows))
return self | [
"set",
"the",
"values",
"from",
"this",
"selection",
":",
"take",
"=",
"take",
"ownership"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1808-L1812 | [
"def",
"convert",
"(",
"self",
",",
"values",
",",
"nan_rep",
",",
"encoding",
",",
"errors",
")",
":",
"self",
".",
"values",
"=",
"Int64Index",
"(",
"np",
".",
"arange",
"(",
"self",
".",
"table",
".",
"nrows",
")",
")",
"return",
"self"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.create_for_block | return a new datacol with the block i | pandas/io/pytables.py | def create_for_block(
cls, i=None, name=None, cname=None, version=None, **kwargs):
""" return a new datacol with the block i """
if cname is None:
cname = name or 'values_block_{idx}'.format(idx=i)
if name is None:
name = cname
# prior to 0.10.1, we ... | def create_for_block(
cls, i=None, name=None, cname=None, version=None, **kwargs):
""" return a new datacol with the block i """
if cname is None:
cname = name or 'values_block_{idx}'.format(idx=i)
if name is None:
name = cname
# prior to 0.10.1, we ... | [
"return",
"a",
"new",
"datacol",
"with",
"the",
"block",
"i"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1839-L1858 | [
"def",
"create_for_block",
"(",
"cls",
",",
"i",
"=",
"None",
",",
"name",
"=",
"None",
",",
"cname",
"=",
"None",
",",
"version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"cname",
"is",
"None",
":",
"cname",
"=",
"name",
"or",
"'val... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.set_metadata | record the metadata | pandas/io/pytables.py | def set_metadata(self, metadata):
""" record the metadata """
if metadata is not None:
metadata = np.array(metadata, copy=False).ravel()
self.metadata = metadata | def set_metadata(self, metadata):
""" record the metadata """
if metadata is not None:
metadata = np.array(metadata, copy=False).ravel()
self.metadata = metadata | [
"record",
"the",
"metadata"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1904-L1908 | [
"def",
"set_metadata",
"(",
"self",
",",
"metadata",
")",
":",
"if",
"metadata",
"is",
"not",
"None",
":",
"metadata",
"=",
"np",
".",
"array",
"(",
"metadata",
",",
"copy",
"=",
"False",
")",
".",
"ravel",
"(",
")",
"self",
".",
"metadata",
"=",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.set_atom | create and setup my atom from the block b | pandas/io/pytables.py | def set_atom(self, block, block_items, existing_col, min_itemsize,
nan_rep, info, encoding=None, errors='strict'):
""" create and setup my atom from the block b """
self.values = list(block_items)
# short-cut certain block types
if block.is_categorical:
ret... | def set_atom(self, block, block_items, existing_col, min_itemsize,
nan_rep, info, encoding=None, errors='strict'):
""" create and setup my atom from the block b """
self.values = list(block_items)
# short-cut certain block types
if block.is_categorical:
ret... | [
"create",
"and",
"setup",
"my",
"atom",
"from",
"the",
"block",
"b"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1939-L1990 | [
"def",
"set_atom",
"(",
"self",
",",
"block",
",",
"block_items",
",",
"existing_col",
",",
"min_itemsize",
",",
"nan_rep",
",",
"info",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"self",
".",
"values",
"=",
"list",
"(",
"b... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.get_atom_coltype | return the PyTables column class for this column | pandas/io/pytables.py | def get_atom_coltype(self, kind=None):
""" return the PyTables column class for this column """
if kind is None:
kind = self.kind
if self.kind.startswith('uint'):
col_name = "UInt{name}Col".format(name=kind[4:])
else:
col_name = "{name}Col".format(name... | def get_atom_coltype(self, kind=None):
""" return the PyTables column class for this column """
if kind is None:
kind = self.kind
if self.kind.startswith('uint'):
col_name = "UInt{name}Col".format(name=kind[4:])
else:
col_name = "{name}Col".format(name... | [
"return",
"the",
"PyTables",
"column",
"class",
"for",
"this",
"column"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2043-L2052 | [
"def",
"get_atom_coltype",
"(",
"self",
",",
"kind",
"=",
"None",
")",
":",
"if",
"kind",
"is",
"None",
":",
"kind",
"=",
"self",
".",
"kind",
"if",
"self",
".",
"kind",
".",
"startswith",
"(",
"'uint'",
")",
":",
"col_name",
"=",
"\"UInt{name}Col\"",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.validate_attr | validate that we have the same order as the existing & same dtype | pandas/io/pytables.py | def validate_attr(self, append):
"""validate that we have the same order as the existing & same dtype"""
if append:
existing_fields = getattr(self.attrs, self.kind_attr, None)
if (existing_fields is not None and
existing_fields != list(self.values)):
... | def validate_attr(self, append):
"""validate that we have the same order as the existing & same dtype"""
if append:
existing_fields = getattr(self.attrs, self.kind_attr, None)
if (existing_fields is not None and
existing_fields != list(self.values)):
... | [
"validate",
"that",
"we",
"have",
"the",
"same",
"order",
"as",
"the",
"existing",
"&",
"same",
"dtype"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2139-L2152 | [
"def",
"validate_attr",
"(",
"self",
",",
"append",
")",
":",
"if",
"append",
":",
"existing_fields",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"kind_attr",
",",
"None",
")",
"if",
"(",
"existing_fields",
"is",
"not",
"None",
"and",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.convert | set the data from this selection (and convert to the correct dtype
if we can) | pandas/io/pytables.py | def convert(self, values, nan_rep, encoding, errors):
"""set the data from this selection (and convert to the correct dtype
if we can)
"""
# values is a recarray
if values.dtype.fields is not None:
values = values[self.cname]
self.set_data(values)
#... | def convert(self, values, nan_rep, encoding, errors):
"""set the data from this selection (and convert to the correct dtype
if we can)
"""
# values is a recarray
if values.dtype.fields is not None:
values = values[self.cname]
self.set_data(values)
#... | [
"set",
"the",
"data",
"from",
"this",
"selection",
"(",
"and",
"convert",
"to",
"the",
"correct",
"dtype",
"if",
"we",
"can",
")"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2154-L2230 | [
"def",
"convert",
"(",
"self",
",",
"values",
",",
"nan_rep",
",",
"encoding",
",",
"errors",
")",
":",
"# values is a recarray",
"if",
"values",
".",
"dtype",
".",
"fields",
"is",
"not",
"None",
":",
"values",
"=",
"values",
"[",
"self",
".",
"cname",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.get_attr | get the data for this column | pandas/io/pytables.py | def get_attr(self):
""" get the data for this column """
self.values = getattr(self.attrs, self.kind_attr, None)
self.dtype = getattr(self.attrs, self.dtype_attr, None)
self.meta = getattr(self.attrs, self.meta_attr, None)
self.set_kind() | def get_attr(self):
""" get the data for this column """
self.values = getattr(self.attrs, self.kind_attr, None)
self.dtype = getattr(self.attrs, self.dtype_attr, None)
self.meta = getattr(self.attrs, self.meta_attr, None)
self.set_kind() | [
"get",
"the",
"data",
"for",
"this",
"column"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2232-L2237 | [
"def",
"get_attr",
"(",
"self",
")",
":",
"self",
".",
"values",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"kind_attr",
",",
"None",
")",
"self",
".",
"dtype",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"dtype_a... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DataCol.set_attr | set the data for this column | pandas/io/pytables.py | def set_attr(self):
""" set the data for this column """
setattr(self.attrs, self.kind_attr, self.values)
setattr(self.attrs, self.meta_attr, self.meta)
if self.dtype is not None:
setattr(self.attrs, self.dtype_attr, self.dtype) | def set_attr(self):
""" set the data for this column """
setattr(self.attrs, self.kind_attr, self.values)
setattr(self.attrs, self.meta_attr, self.meta)
if self.dtype is not None:
setattr(self.attrs, self.dtype_attr, self.dtype) | [
"set",
"the",
"data",
"for",
"this",
"column"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2239-L2244 | [
"def",
"set_attr",
"(",
"self",
")",
":",
"setattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"kind_attr",
",",
"self",
".",
"values",
")",
"setattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"meta_attr",
",",
"self",
".",
"meta",
")",
"if"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Fixed.set_version | compute and set our version | pandas/io/pytables.py | def set_version(self):
""" compute and set our version """
version = _ensure_decoded(
getattr(self.group._v_attrs, 'pandas_version', None))
try:
self.version = tuple(int(x) for x in version.split('.'))
if len(self.version) == 2:
self.version = ... | def set_version(self):
""" compute and set our version """
version = _ensure_decoded(
getattr(self.group._v_attrs, 'pandas_version', None))
try:
self.version = tuple(int(x) for x in version.split('.'))
if len(self.version) == 2:
self.version = ... | [
"compute",
"and",
"set",
"our",
"version"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2307-L2316 | [
"def",
"set_version",
"(",
"self",
")",
":",
"version",
"=",
"_ensure_decoded",
"(",
"getattr",
"(",
"self",
".",
"group",
".",
"_v_attrs",
",",
"'pandas_version'",
",",
"None",
")",
")",
"try",
":",
"self",
".",
"version",
"=",
"tuple",
"(",
"int",
"(... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Fixed.set_object_info | set my pandas type & version | pandas/io/pytables.py | def set_object_info(self):
""" set my pandas type & version """
self.attrs.pandas_type = str(self.pandas_kind)
self.attrs.pandas_version = str(_version)
self.set_version() | def set_object_info(self):
""" set my pandas type & version """
self.attrs.pandas_type = str(self.pandas_kind)
self.attrs.pandas_version = str(_version)
self.set_version() | [
"set",
"my",
"pandas",
"type",
"&",
"version"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2339-L2343 | [
"def",
"set_object_info",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"pandas_type",
"=",
"str",
"(",
"self",
".",
"pandas_kind",
")",
"self",
".",
"attrs",
".",
"pandas_version",
"=",
"str",
"(",
"_version",
")",
"self",
".",
"set_version",
"(",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Fixed.infer_axes | infer the axes of my storer
return a boolean indicating if we have a valid storer or not | pandas/io/pytables.py | def infer_axes(self):
""" infer the axes of my storer
return a boolean indicating if we have a valid storer or not """
s = self.storable
if s is None:
return False
self.get_attrs()
return True | def infer_axes(self):
""" infer the axes of my storer
return a boolean indicating if we have a valid storer or not """
s = self.storable
if s is None:
return False
self.get_attrs()
return True | [
"infer",
"the",
"axes",
"of",
"my",
"storer",
"return",
"a",
"boolean",
"indicating",
"if",
"we",
"have",
"a",
"valid",
"storer",
"or",
"not"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2416-L2424 | [
"def",
"infer_axes",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"storable",
"if",
"s",
"is",
"None",
":",
"return",
"False",
"self",
".",
"get_attrs",
"(",
")",
"return",
"True"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Fixed.delete | support fully deleting the node in its entirety (only) - where
specification must be None | pandas/io/pytables.py | def delete(self, where=None, start=None, stop=None, **kwargs):
"""
support fully deleting the node in its entirety (only) - where
specification must be None
"""
if com._all_none(where, start, stop):
self._handle.remove_node(self.group, recursive=True)
retu... | def delete(self, where=None, start=None, stop=None, **kwargs):
"""
support fully deleting the node in its entirety (only) - where
specification must be None
"""
if com._all_none(where, start, stop):
self._handle.remove_node(self.group, recursive=True)
retu... | [
"support",
"fully",
"deleting",
"the",
"node",
"in",
"its",
"entirety",
"(",
"only",
")",
"-",
"where",
"specification",
"must",
"be",
"None"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2434-L2443 | [
"def",
"delete",
"(",
"self",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"com",
".",
"_all_none",
"(",
"where",
",",
"start",
",",
"stop",
")",
":",
"self",
".",
"_ha... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericFixed.validate_read | remove table keywords from kwargs and return
raise if any keywords are passed which are not-None | pandas/io/pytables.py | def validate_read(self, kwargs):
"""
remove table keywords from kwargs and return
raise if any keywords are passed which are not-None
"""
kwargs = copy.copy(kwargs)
columns = kwargs.pop('columns', None)
if columns is not None:
raise TypeError("cannot ... | def validate_read(self, kwargs):
"""
remove table keywords from kwargs and return
raise if any keywords are passed which are not-None
"""
kwargs = copy.copy(kwargs)
columns = kwargs.pop('columns', None)
if columns is not None:
raise TypeError("cannot ... | [
"remove",
"table",
"keywords",
"from",
"kwargs",
"and",
"return",
"raise",
"if",
"any",
"keywords",
"are",
"passed",
"which",
"are",
"not",
"-",
"None"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2480-L2497 | [
"def",
"validate_read",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"copy",
".",
"copy",
"(",
"kwargs",
")",
"columns",
"=",
"kwargs",
".",
"pop",
"(",
"'columns'",
",",
"None",
")",
"if",
"columns",
"is",
"not",
"None",
":",
"raise",
"TypeE... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericFixed.set_attrs | set our object attributes | pandas/io/pytables.py | def set_attrs(self):
""" set our object attributes """
self.attrs.encoding = self.encoding
self.attrs.errors = self.errors | def set_attrs(self):
""" set our object attributes """
self.attrs.encoding = self.encoding
self.attrs.errors = self.errors | [
"set",
"our",
"object",
"attributes"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2503-L2506 | [
"def",
"set_attrs",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"encoding",
"=",
"self",
".",
"encoding",
"self",
".",
"attrs",
".",
"errors",
"=",
"self",
".",
"errors"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericFixed.get_attrs | retrieve our attributes | pandas/io/pytables.py | def get_attrs(self):
""" retrieve our attributes """
self.encoding = _ensure_encoding(getattr(self.attrs, 'encoding', None))
self.errors = _ensure_decoded(getattr(self.attrs, 'errors', 'strict'))
for n in self.attributes:
setattr(self, n, _ensure_decoded(getattr(self.attrs, n... | def get_attrs(self):
""" retrieve our attributes """
self.encoding = _ensure_encoding(getattr(self.attrs, 'encoding', None))
self.errors = _ensure_decoded(getattr(self.attrs, 'errors', 'strict'))
for n in self.attributes:
setattr(self, n, _ensure_decoded(getattr(self.attrs, n... | [
"retrieve",
"our",
"attributes"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2508-L2513 | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"encoding",
"=",
"_ensure_encoding",
"(",
"getattr",
"(",
"self",
".",
"attrs",
",",
"'encoding'",
",",
"None",
")",
")",
"self",
".",
"errors",
"=",
"_ensure_decoded",
"(",
"getattr",
"(",
"self",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericFixed.read_array | read an array for the specified node (off of group | pandas/io/pytables.py | def read_array(self, key, start=None, stop=None):
""" read an array for the specified node (off of group """
import tables
node = getattr(self.group, key)
attrs = node._v_attrs
transposed = getattr(attrs, 'transposed', False)
if isinstance(node, tables.VLArray):
... | def read_array(self, key, start=None, stop=None):
""" read an array for the specified node (off of group """
import tables
node = getattr(self.group, key)
attrs = node._v_attrs
transposed = getattr(attrs, 'transposed', False)
if isinstance(node, tables.VLArray):
... | [
"read",
"an",
"array",
"for",
"the",
"specified",
"node",
"(",
"off",
"of",
"group"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2518-L2549 | [
"def",
"read_array",
"(",
"self",
",",
"key",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"import",
"tables",
"node",
"=",
"getattr",
"(",
"self",
".",
"group",
",",
"key",
")",
"attrs",
"=",
"node",
".",
"_v_attrs",
"transposed",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericFixed.write_array_empty | write a 0-len array | pandas/io/pytables.py | def write_array_empty(self, key, value):
""" write a 0-len array """
# ugly hack for length 0 axes
arr = np.empty((1,) * value.ndim)
self._handle.create_array(self.group, key, arr)
getattr(self.group, key)._v_attrs.value_type = str(value.dtype)
getattr(self.group, key)._... | def write_array_empty(self, key, value):
""" write a 0-len array """
# ugly hack for length 0 axes
arr = np.empty((1,) * value.ndim)
self._handle.create_array(self.group, key, arr)
getattr(self.group, key)._v_attrs.value_type = str(value.dtype)
getattr(self.group, key)._... | [
"write",
"a",
"0",
"-",
"len",
"array"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2702-L2709 | [
"def",
"write_array_empty",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"# ugly hack for length 0 axes",
"arr",
"=",
"np",
".",
"empty",
"(",
"(",
"1",
",",
")",
"*",
"value",
".",
"ndim",
")",
"self",
".",
"_handle",
".",
"create_array",
"(",
"se... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | SparseFixed.validate_read | we don't support start, stop kwds in Sparse | pandas/io/pytables.py | def validate_read(self, kwargs):
"""
we don't support start, stop kwds in Sparse
"""
kwargs = super().validate_read(kwargs)
if 'start' in kwargs or 'stop' in kwargs:
raise NotImplementedError("start and/or stop are not supported "
... | def validate_read(self, kwargs):
"""
we don't support start, stop kwds in Sparse
"""
kwargs = super().validate_read(kwargs)
if 'start' in kwargs or 'stop' in kwargs:
raise NotImplementedError("start and/or stop are not supported "
... | [
"we",
"don",
"t",
"support",
"start",
"stop",
"kwds",
"in",
"Sparse"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2859-L2867 | [
"def",
"validate_read",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
")",
".",
"validate_read",
"(",
"kwargs",
")",
"if",
"'start'",
"in",
"kwargs",
"or",
"'stop'",
"in",
"kwargs",
":",
"raise",
"NotImplementedError",
"(",
"\"start an... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | SparseFrameFixed.write | write it as a collection of individual sparse series | pandas/io/pytables.py | def write(self, obj, **kwargs):
""" write it as a collection of individual sparse series """
super().write(obj, **kwargs)
for name, ss in obj.items():
key = 'sparse_series_{name}'.format(name=name)
if key not in self.group._v_children:
node = self._handle.... | def write(self, obj, **kwargs):
""" write it as a collection of individual sparse series """
super().write(obj, **kwargs)
for name, ss in obj.items():
key = 'sparse_series_{name}'.format(name=name)
if key not in self.group._v_children:
node = self._handle.... | [
"write",
"it",
"as",
"a",
"collection",
"of",
"individual",
"sparse",
"series"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2911-L2924 | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"write",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
"for",
"name",
",",
"ss",
"in",
"obj",
".",
"items",
"(",
")",
":",
"key",
"=",
"'sparse_se... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.validate | validate against an existing table | pandas/io/pytables.py | def validate(self, other):
""" validate against an existing table """
if other is None:
return
if other.table_type != self.table_type:
raise TypeError(
"incompatible table_type with existing "
"[{other} - {self}]".format(
... | def validate(self, other):
""" validate against an existing table """
if other is None:
return
if other.table_type != self.table_type:
raise TypeError(
"incompatible table_type with existing "
"[{other} - {self}]".format(
... | [
"validate",
"against",
"an",
"existing",
"table"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3095-L3123 | [
"def",
"validate",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
"is",
"None",
":",
"return",
"if",
"other",
".",
"table_type",
"!=",
"self",
".",
"table_type",
":",
"raise",
"TypeError",
"(",
"\"incompatible table_type with existing \"",
"\"[{other} - {se... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.