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 | Table.validate_metadata | create / validate metadata | pandas/io/pytables.py | def validate_metadata(self, existing):
""" create / validate metadata """
self.metadata = [
c.name for c in self.values_axes if c.metadata is not None] | def validate_metadata(self, existing):
""" create / validate metadata """
self.metadata = [
c.name for c in self.values_axes if c.metadata is not None] | [
"create",
"/",
"validate",
"metadata"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3130-L3133 | [
"def",
"validate_metadata",
"(",
"self",
",",
"existing",
")",
":",
"self",
".",
"metadata",
"=",
"[",
"c",
".",
"name",
"for",
"c",
"in",
"self",
".",
"values_axes",
"if",
"c",
".",
"metadata",
"is",
"not",
"None",
"]"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.validate_multiindex | validate that we can store the multi-index; reset and return the
new object | pandas/io/pytables.py | def validate_multiindex(self, obj):
"""validate that we can store the multi-index; reset and return the
new object
"""
levels = [l if l is not None else "level_{0}".format(i)
for i, l in enumerate(obj.index.names)]
try:
return obj.reset_index(), leve... | def validate_multiindex(self, obj):
"""validate that we can store the multi-index; reset and return the
new object
"""
levels = [l if l is not None else "level_{0}".format(i)
for i, l in enumerate(obj.index.names)]
try:
return obj.reset_index(), leve... | [
"validate",
"that",
"we",
"can",
"store",
"the",
"multi",
"-",
"index",
";",
"reset",
"and",
"return",
"the",
"new",
"object"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3135-L3145 | [
"def",
"validate_multiindex",
"(",
"self",
",",
"obj",
")",
":",
"levels",
"=",
"[",
"l",
"if",
"l",
"is",
"not",
"None",
"else",
"\"level_{0}\"",
".",
"format",
"(",
"i",
")",
"for",
"i",
",",
"l",
"in",
"enumerate",
"(",
"obj",
".",
"index",
".",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.nrows_expected | based on our axes, compute the expected nrows | pandas/io/pytables.py | def nrows_expected(self):
""" based on our axes, compute the expected nrows """
return np.prod([i.cvalues.shape[0] for i in self.index_axes]) | def nrows_expected(self):
""" based on our axes, compute the expected nrows """
return np.prod([i.cvalues.shape[0] for i in self.index_axes]) | [
"based",
"on",
"our",
"axes",
"compute",
"the",
"expected",
"nrows"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3148-L3150 | [
"def",
"nrows_expected",
"(",
"self",
")",
":",
"return",
"np",
".",
"prod",
"(",
"[",
"i",
".",
"cvalues",
".",
"shape",
"[",
"0",
"]",
"for",
"i",
"in",
"self",
".",
"index_axes",
"]",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.data_orientation | return a tuple of my permutated axes, non_indexable at the front | pandas/io/pytables.py | def data_orientation(self):
"""return a tuple of my permutated axes, non_indexable at the front"""
return tuple(itertools.chain([int(a[0]) for a in self.non_index_axes],
[int(a.axis) for a in self.index_axes])) | def data_orientation(self):
"""return a tuple of my permutated axes, non_indexable at the front"""
return tuple(itertools.chain([int(a[0]) for a in self.non_index_axes],
[int(a.axis) for a in self.index_axes])) | [
"return",
"a",
"tuple",
"of",
"my",
"permutated",
"axes",
"non_indexable",
"at",
"the",
"front"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3188-L3191 | [
"def",
"data_orientation",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"itertools",
".",
"chain",
"(",
"[",
"int",
"(",
"a",
"[",
"0",
"]",
")",
"for",
"a",
"in",
"self",
".",
"non_index_axes",
"]",
",",
"[",
"int",
"(",
"a",
".",
"axis",
")",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.queryables | return a dict of the kinds allowable columns for this object | pandas/io/pytables.py | def queryables(self):
""" return a dict of the kinds allowable columns for this object """
# compute the values_axes queryables
return dict(
[(a.cname, a) for a in self.index_axes] +
[(self.storage_obj_type._AXIS_NAMES[axis], None)
for axis, values in self.n... | def queryables(self):
""" return a dict of the kinds allowable columns for this object """
# compute the values_axes queryables
return dict(
[(a.cname, a) for a in self.index_axes] +
[(self.storage_obj_type._AXIS_NAMES[axis], None)
for axis, values in self.n... | [
"return",
"a",
"dict",
"of",
"the",
"kinds",
"allowable",
"columns",
"for",
"this",
"object"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3193-L3203 | [
"def",
"queryables",
"(",
"self",
")",
":",
"# compute the values_axes queryables",
"return",
"dict",
"(",
"[",
"(",
"a",
".",
"cname",
",",
"a",
")",
"for",
"a",
"in",
"self",
".",
"index_axes",
"]",
"+",
"[",
"(",
"self",
".",
"storage_obj_type",
".",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table._get_metadata_path | return the metadata pathname for this key | pandas/io/pytables.py | def _get_metadata_path(self, key):
""" return the metadata pathname for this key """
return "{group}/meta/{key}/meta".format(group=self.group._v_pathname,
key=key) | def _get_metadata_path(self, key):
""" return the metadata pathname for this key """
return "{group}/meta/{key}/meta".format(group=self.group._v_pathname,
key=key) | [
"return",
"the",
"metadata",
"pathname",
"for",
"this",
"key"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3213-L3216 | [
"def",
"_get_metadata_path",
"(",
"self",
",",
"key",
")",
":",
"return",
"\"{group}/meta/{key}/meta\"",
".",
"format",
"(",
"group",
"=",
"self",
".",
"group",
".",
"_v_pathname",
",",
"key",
"=",
"key",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.write_metadata | write out a meta data array to the key as a fixed-format Series
Parameters
----------
key : string
values : ndarray | pandas/io/pytables.py | def write_metadata(self, key, values):
"""
write out a meta data array to the key as a fixed-format Series
Parameters
----------
key : string
values : ndarray
"""
values = Series(values)
self.parent.put(self._get_metadata_path(key), values, forma... | def write_metadata(self, key, values):
"""
write out a meta data array to the key as a fixed-format Series
Parameters
----------
key : string
values : ndarray
"""
values = Series(values)
self.parent.put(self._get_metadata_path(key), values, forma... | [
"write",
"out",
"a",
"meta",
"data",
"array",
"to",
"the",
"key",
"as",
"a",
"fixed",
"-",
"format",
"Series"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3218-L3231 | [
"def",
"write_metadata",
"(",
"self",
",",
"key",
",",
"values",
")",
":",
"values",
"=",
"Series",
"(",
"values",
")",
"self",
".",
"parent",
".",
"put",
"(",
"self",
".",
"_get_metadata_path",
"(",
"key",
")",
",",
"values",
",",
"format",
"=",
"'t... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.read_metadata | return the meta data array for this key | pandas/io/pytables.py | def read_metadata(self, key):
""" return the meta data array for this key """
if getattr(getattr(self.group, 'meta', None), key, None) is not None:
return self.parent.select(self._get_metadata_path(key))
return None | def read_metadata(self, key):
""" return the meta data array for this key """
if getattr(getattr(self.group, 'meta', None), key, None) is not None:
return self.parent.select(self._get_metadata_path(key))
return None | [
"return",
"the",
"meta",
"data",
"array",
"for",
"this",
"key"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3233-L3237 | [
"def",
"read_metadata",
"(",
"self",
",",
"key",
")",
":",
"if",
"getattr",
"(",
"getattr",
"(",
"self",
".",
"group",
",",
"'meta'",
",",
"None",
")",
",",
"key",
",",
"None",
")",
"is",
"not",
"None",
":",
"return",
"self",
".",
"parent",
".",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.set_attrs | set our table type & indexables | pandas/io/pytables.py | def set_attrs(self):
""" set our table type & indexables """
self.attrs.table_type = str(self.table_type)
self.attrs.index_cols = self.index_cols()
self.attrs.values_cols = self.values_cols()
self.attrs.non_index_axes = self.non_index_axes
self.attrs.data_columns = self.d... | def set_attrs(self):
""" set our table type & indexables """
self.attrs.table_type = str(self.table_type)
self.attrs.index_cols = self.index_cols()
self.attrs.values_cols = self.values_cols()
self.attrs.non_index_axes = self.non_index_axes
self.attrs.data_columns = self.d... | [
"set",
"our",
"table",
"type",
"&",
"indexables"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3243-L3255 | [
"def",
"set_attrs",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"table_type",
"=",
"str",
"(",
"self",
".",
"table_type",
")",
"self",
".",
"attrs",
".",
"index_cols",
"=",
"self",
".",
"index_cols",
"(",
")",
"self",
".",
"attrs",
".",
"values... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.get_attrs | retrieve our attributes | pandas/io/pytables.py | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = getattr(
self.attrs, 'non_index_axes', None) or []
self.data_columns = getattr(
self.attrs, 'data_columns', None) or []
self.info = getattr(
self.attrs, 'info', None) or dict()
... | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = getattr(
self.attrs, 'non_index_axes', None) or []
self.data_columns = getattr(
self.attrs, 'data_columns', None) or []
self.info = getattr(
self.attrs, 'info', None) or dict()
... | [
"retrieve",
"our",
"attributes"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3257-L3278 | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"non_index_axes",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"'non_index_axes'",
",",
"None",
")",
"or",
"[",
"]",
"self",
".",
"data_columns",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.validate_version | are we trying to operate on an old version? | pandas/io/pytables.py | def validate_version(self, where=None):
""" are we trying to operate on an old version? """
if where is not None:
if (self.version[0] <= 0 and self.version[1] <= 10 and
self.version[2] < 1):
ws = incompatibility_doc % '.'.join(
[str(x) ... | def validate_version(self, where=None):
""" are we trying to operate on an old version? """
if where is not None:
if (self.version[0] <= 0 and self.version[1] <= 10 and
self.version[2] < 1):
ws = incompatibility_doc % '.'.join(
[str(x) ... | [
"are",
"we",
"trying",
"to",
"operate",
"on",
"an",
"old",
"version?"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3280-L3287 | [
"def",
"validate_version",
"(",
"self",
",",
"where",
"=",
"None",
")",
":",
"if",
"where",
"is",
"not",
"None",
":",
"if",
"(",
"self",
".",
"version",
"[",
"0",
"]",
"<=",
"0",
"and",
"self",
".",
"version",
"[",
"1",
"]",
"<=",
"10",
"and",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.validate_min_itemsize | validate the min_itemisze doesn't contain items that are not in the
axes this needs data_columns to be defined | pandas/io/pytables.py | def validate_min_itemsize(self, min_itemsize):
"""validate the min_itemisze doesn't contain items that are not in the
axes this needs data_columns to be defined
"""
if min_itemsize is None:
return
if not isinstance(min_itemsize, dict):
return
q = ... | def validate_min_itemsize(self, min_itemsize):
"""validate the min_itemisze doesn't contain items that are not in the
axes this needs data_columns to be defined
"""
if min_itemsize is None:
return
if not isinstance(min_itemsize, dict):
return
q = ... | [
"validate",
"the",
"min_itemisze",
"doesn",
"t",
"contain",
"items",
"that",
"are",
"not",
"in",
"the",
"axes",
"this",
"needs",
"data_columns",
"to",
"be",
"defined"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3289-L3307 | [
"def",
"validate_min_itemsize",
"(",
"self",
",",
"min_itemsize",
")",
":",
"if",
"min_itemsize",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"min_itemsize",
",",
"dict",
")",
":",
"return",
"q",
"=",
"self",
".",
"queryables",
"(",
")",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.indexables | create/cache the indexables if they don't exist | pandas/io/pytables.py | def indexables(self):
""" create/cache the indexables if they don't exist """
if self._indexables is None:
self._indexables = []
# index columns
self._indexables.extend([
IndexCol(name=name, axis=axis, pos=i)
for i, (axis, name) in en... | def indexables(self):
""" create/cache the indexables if they don't exist """
if self._indexables is None:
self._indexables = []
# index columns
self._indexables.extend([
IndexCol(name=name, axis=axis, pos=i)
for i, (axis, name) in en... | [
"create",
"/",
"cache",
"the",
"indexables",
"if",
"they",
"don",
"t",
"exist"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3310-L3336 | [
"def",
"indexables",
"(",
"self",
")",
":",
"if",
"self",
".",
"_indexables",
"is",
"None",
":",
"self",
".",
"_indexables",
"=",
"[",
"]",
"# index columns",
"self",
".",
"_indexables",
".",
"extend",
"(",
"[",
"IndexCol",
"(",
"name",
"=",
"name",
",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.create_index | Create a pytables index on the specified columns
note: cannot index Time64Col() or ComplexCol currently;
PyTables must be >= 3.0
Parameters
----------
columns : False (don't create an index), True (create all columns
index), None or list_like (the indexers to ind... | pandas/io/pytables.py | def create_index(self, columns=None, optlevel=None, kind=None):
"""
Create a pytables index on the specified columns
note: cannot index Time64Col() or ComplexCol currently;
PyTables must be >= 3.0
Parameters
----------
columns : False (don't create an index),... | def create_index(self, columns=None, optlevel=None, kind=None):
"""
Create a pytables index on the specified columns
note: cannot index Time64Col() or ComplexCol currently;
PyTables must be >= 3.0
Parameters
----------
columns : False (don't create an index),... | [
"Create",
"a",
"pytables",
"index",
"on",
"the",
"specified",
"columns",
"note",
":",
"cannot",
"index",
"Time64Col",
"()",
"or",
"ComplexCol",
"currently",
";",
"PyTables",
"must",
"be",
">",
"=",
"3",
".",
"0"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3338-L3405 | [
"def",
"create_index",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"optlevel",
"=",
"None",
",",
"kind",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"infer_axes",
"(",
")",
":",
"return",
"if",
"columns",
"is",
"False",
":",
"return",
"# inde... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.read_axes | create and return the axes sniffed from the table: return boolean
for success | pandas/io/pytables.py | def read_axes(self, where, **kwargs):
"""create and return the axes sniffed from the table: return boolean
for success
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
return False
# cre... | def read_axes(self, where, **kwargs):
"""create and return the axes sniffed from the table: return boolean
for success
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
return False
# cre... | [
"create",
"and",
"return",
"the",
"axes",
"sniffed",
"from",
"the",
"table",
":",
"return",
"boolean",
"for",
"success"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3407-L3429 | [
"def",
"read_axes",
"(",
"self",
",",
"where",
",",
"*",
"*",
"kwargs",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
"where",
")",
"# infer the data kind",
"if",
"not",
"self",
".",
"infer_axes",
"(",
")",
":",
"return",
"False",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.validate_data_columns | take the input data_columns and min_itemize and create a data
columns spec | pandas/io/pytables.py | def validate_data_columns(self, data_columns, min_itemsize):
"""take the input data_columns and min_itemize and create a data
columns spec
"""
if not len(self.non_index_axes):
return []
axis, axis_labels = self.non_index_axes[0]
info = self.info.get(axis, di... | def validate_data_columns(self, data_columns, min_itemsize):
"""take the input data_columns and min_itemize and create a data
columns spec
"""
if not len(self.non_index_axes):
return []
axis, axis_labels = self.non_index_axes[0]
info = self.info.get(axis, di... | [
"take",
"the",
"input",
"data_columns",
"and",
"min_itemize",
"and",
"create",
"a",
"data",
"columns",
"spec"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3435-L3466 | [
"def",
"validate_data_columns",
"(",
"self",
",",
"data_columns",
",",
"min_itemsize",
")",
":",
"if",
"not",
"len",
"(",
"self",
".",
"non_index_axes",
")",
":",
"return",
"[",
"]",
"axis",
",",
"axis_labels",
"=",
"self",
".",
"non_index_axes",
"[",
"0",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.create_axes | create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
axes: a list of the axes in order to create (names or numbers of
the axes)
obj : the object to create axes o... | pandas/io/pytables.py | def create_axes(self, axes, obj, validate=True, nan_rep=None,
data_columns=None, min_itemsize=None, **kwargs):
""" create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
... | def create_axes(self, axes, obj, validate=True, nan_rep=None,
data_columns=None, min_itemsize=None, **kwargs):
""" create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
... | [
"create",
"and",
"return",
"the",
"axes",
"leagcy",
"tables",
"create",
"an",
"indexable",
"column",
"indexable",
"index",
"non",
"-",
"indexable",
"fields"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3468-L3681 | [
"def",
"create_axes",
"(",
"self",
",",
"axes",
",",
"obj",
",",
"validate",
"=",
"True",
",",
"nan_rep",
"=",
"None",
",",
"data_columns",
"=",
"None",
",",
"min_itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# set the default axes if needed"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.process_axes | process axes filters | pandas/io/pytables.py | def process_axes(self, obj, columns=None):
""" process axes filters """
# make a copy to avoid side effects
if columns is not None:
columns = list(columns)
# make sure to include levels if we have them
if columns is not None and self.is_multi_index:
for ... | def process_axes(self, obj, columns=None):
""" process axes filters """
# make a copy to avoid side effects
if columns is not None:
columns = list(columns)
# make sure to include levels if we have them
if columns is not None and self.is_multi_index:
for ... | [
"process",
"axes",
"filters"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3683-L3741 | [
"def",
"process_axes",
"(",
"self",
",",
"obj",
",",
"columns",
"=",
"None",
")",
":",
"# make a copy to avoid side effects",
"if",
"columns",
"is",
"not",
"None",
":",
"columns",
"=",
"list",
"(",
"columns",
")",
"# make sure to include levels if we have them",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.create_description | create the description of the table from the axes & values | pandas/io/pytables.py | def create_description(self, complib=None, complevel=None,
fletcher32=False, expectedrows=None):
""" create the description of the table from the axes & values """
# provided expected rows if its passed
if expectedrows is None:
expectedrows = max(self.nrow... | def create_description(self, complib=None, complevel=None,
fletcher32=False, expectedrows=None):
""" create the description of the table from the axes & values """
# provided expected rows if its passed
if expectedrows is None:
expectedrows = max(self.nrow... | [
"create",
"the",
"description",
"of",
"the",
"table",
"from",
"the",
"axes",
"&",
"values"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3743-L3766 | [
"def",
"create_description",
"(",
"self",
",",
"complib",
"=",
"None",
",",
"complevel",
"=",
"None",
",",
"fletcher32",
"=",
"False",
",",
"expectedrows",
"=",
"None",
")",
":",
"# provided expected rows if its passed",
"if",
"expectedrows",
"is",
"None",
":",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.read_coordinates | select coordinates (row numbers) from a table; return the
coordinates object | pandas/io/pytables.py | def read_coordinates(self, where=None, start=None, stop=None, **kwargs):
"""select coordinates (row numbers) from a table; return the
coordinates object
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
... | def read_coordinates(self, where=None, start=None, stop=None, **kwargs):
"""select coordinates (row numbers) from a table; return the
coordinates object
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
... | [
"select",
"coordinates",
"(",
"row",
"numbers",
")",
"from",
"a",
"table",
";",
"return",
"the",
"coordinates",
"object"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3768-L3791 | [
"def",
"read_coordinates",
"(",
"self",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
"where",
")",
"# infer the data kind",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Table.read_column | return a single column from the table, generally only indexables
are interesting | pandas/io/pytables.py | def read_column(self, column, where=None, start=None, stop=None):
"""return a single column from the table, generally only indexables
are interesting
"""
# validate the version
self.validate_version()
# infer the data kind
if not self.infer_axes():
r... | def read_column(self, column, where=None, start=None, stop=None):
"""return a single column from the table, generally only indexables
are interesting
"""
# validate the version
self.validate_version()
# infer the data kind
if not self.infer_axes():
r... | [
"return",
"a",
"single",
"column",
"from",
"the",
"table",
"generally",
"only",
"indexables",
"are",
"interesting"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3793-L3829 | [
"def",
"read_column",
"(",
"self",
",",
"column",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
")",
"# infer the data kind",
"if",
"not",
"self",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | LegacyTable.read | we have n indexable columns, with an arbitrary number of data
axes | pandas/io/pytables.py | def read(self, where=None, columns=None, **kwargs):
"""we have n indexable columns, with an arbitrary number of data
axes
"""
if not self.read_axes(where=where, **kwargs):
return None
raise NotImplementedError("Panel is removed in pandas 0.25.0") | def read(self, where=None, columns=None, **kwargs):
"""we have n indexable columns, with an arbitrary number of data
axes
"""
if not self.read_axes(where=where, **kwargs):
return None
raise NotImplementedError("Panel is removed in pandas 0.25.0") | [
"we",
"have",
"n",
"indexable",
"columns",
"with",
"an",
"arbitrary",
"number",
"of",
"data",
"axes"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3872-L3880 | [
"def",
"read",
"(",
"self",
",",
"where",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"read_axes",
"(",
"where",
"=",
"where",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"None",
"raise"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | AppendableTable.write_data | we form the data into a 2-d including indexes,values,mask
write chunk-by-chunk | pandas/io/pytables.py | def write_data(self, chunksize, dropna=False):
""" we form the data into a 2-d including indexes,values,mask
write chunk-by-chunk """
names = self.dtype.names
nrows = self.nrows_expected
# if dropna==True, then drop ALL nan rows
masks = []
if dropna:
... | def write_data(self, chunksize, dropna=False):
""" we form the data into a 2-d including indexes,values,mask
write chunk-by-chunk """
names = self.dtype.names
nrows = self.nrows_expected
# if dropna==True, then drop ALL nan rows
masks = []
if dropna:
... | [
"we",
"form",
"the",
"data",
"into",
"a",
"2",
"-",
"d",
"including",
"indexes",
"values",
"mask",
"write",
"chunk",
"-",
"by",
"-",
"chunk"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3930-L4003 | [
"def",
"write_data",
"(",
"self",
",",
"chunksize",
",",
"dropna",
"=",
"False",
")",
":",
"names",
"=",
"self",
".",
"dtype",
".",
"names",
"nrows",
"=",
"self",
".",
"nrows_expected",
"# if dropna==True, then drop ALL nan rows",
"masks",
"=",
"[",
"]",
"if... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | AppendableTable.write_data_chunk | Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values | pandas/io/pytables.py | def write_data_chunk(self, rows, indexes, mask, values):
"""
Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values
"""
# 0 l... | def write_data_chunk(self, rows, indexes, mask, values):
"""
Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values
"""
# 0 l... | [
"Parameters",
"----------",
"rows",
":",
"an",
"empty",
"memory",
"space",
"where",
"we",
"are",
"putting",
"the",
"chunk",
"indexes",
":",
"an",
"array",
"of",
"the",
"indexes",
"mask",
":",
"an",
"array",
"of",
"the",
"masks",
"values",
":",
"an",
"arr... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4005-L4052 | [
"def",
"write_data_chunk",
"(",
"self",
",",
"rows",
",",
"indexes",
",",
"mask",
",",
"values",
")",
":",
"# 0 len",
"for",
"v",
"in",
"values",
":",
"if",
"not",
"np",
".",
"prod",
"(",
"v",
".",
"shape",
")",
":",
"return",
"try",
":",
"nrows",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | AppendableSeriesTable.write | we are going to write this as a frame table | pandas/io/pytables.py | def write(self, obj, data_columns=None, **kwargs):
""" we are going to write this as a frame table """
if not isinstance(obj, DataFrame):
name = obj.name or 'values'
obj = DataFrame({name: obj}, index=obj.index)
obj.columns = [name]
return super().write(obj=ob... | def write(self, obj, data_columns=None, **kwargs):
""" we are going to write this as a frame table """
if not isinstance(obj, DataFrame):
name = obj.name or 'values'
obj = DataFrame({name: obj}, index=obj.index)
obj.columns = [name]
return super().write(obj=ob... | [
"we",
"are",
"going",
"to",
"write",
"this",
"as",
"a",
"frame",
"table"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4196-L4203 | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"data_columns",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"DataFrame",
")",
":",
"name",
"=",
"obj",
".",
"name",
"or",
"'values'",
"obj",
"=",
"DataFra... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | AppendableMultiSeriesTable.write | we are going to write this as a frame table | pandas/io/pytables.py | def write(self, obj, **kwargs):
""" we are going to write this as a frame table """
name = obj.name or 'values'
obj, self.levels = self.validate_multiindex(obj)
cols = list(self.levels)
cols.append(name)
obj.columns = cols
return super().write(obj=obj, **kwargs) | def write(self, obj, **kwargs):
""" we are going to write this as a frame table """
name = obj.name or 'values'
obj, self.levels = self.validate_multiindex(obj)
cols = list(self.levels)
cols.append(name)
obj.columns = cols
return super().write(obj=obj, **kwargs) | [
"we",
"are",
"going",
"to",
"write",
"this",
"as",
"a",
"frame",
"table"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4229-L4236 | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"obj",
".",
"name",
"or",
"'values'",
"obj",
",",
"self",
".",
"levels",
"=",
"self",
".",
"validate_multiindex",
"(",
"obj",
")",
"cols",
"=",
"list",
"(",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericTable.get_attrs | retrieve our attributes | pandas/io/pytables.py | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = []
self.nan_rep = None
self.levels = []
self.index_axes = [a.infer(self)
for a in self.indexables if a.is_an_indexable]
self.values_axes = [a.infer(self)
... | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = []
self.nan_rep = None
self.levels = []
self.index_axes = [a.infer(self)
for a in self.indexables if a.is_an_indexable]
self.values_axes = [a.infer(self)
... | [
"retrieve",
"our",
"attributes"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4254-L4264 | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"non_index_axes",
"=",
"[",
"]",
"self",
".",
"nan_rep",
"=",
"None",
"self",
".",
"levels",
"=",
"[",
"]",
"self",
".",
"index_axes",
"=",
"[",
"a",
".",
"infer",
"(",
"self",
")",
"for",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | GenericTable.indexables | create the indexables from the table description | pandas/io/pytables.py | def indexables(self):
""" create the indexables from the table description """
if self._indexables is None:
d = self.description
# the index columns is just a simple index
self._indexables = [GenericIndexCol(name='index', axis=0)]
for i, n in enumerate(... | def indexables(self):
""" create the indexables from the table description """
if self._indexables is None:
d = self.description
# the index columns is just a simple index
self._indexables = [GenericIndexCol(name='index', axis=0)]
for i, n in enumerate(... | [
"create",
"the",
"indexables",
"from",
"the",
"table",
"description"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4267-L4282 | [
"def",
"indexables",
"(",
"self",
")",
":",
"if",
"self",
".",
"_indexables",
"is",
"None",
":",
"d",
"=",
"self",
".",
"description",
"# the index columns is just a simple index",
"self",
".",
"_indexables",
"=",
"[",
"GenericIndexCol",
"(",
"name",
"=",
"'in... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Selection.generate | where can be a : dict,list,tuple,string | pandas/io/pytables.py | def generate(self, where):
""" where can be a : dict,list,tuple,string """
if where is None:
return None
q = self.table.queryables()
try:
return Expr(where, queryables=q, encoding=self.table.encoding)
except NameError:
# raise a nice message, ... | def generate(self, where):
""" where can be a : dict,list,tuple,string """
if where is None:
return None
q = self.table.queryables()
try:
return Expr(where, queryables=q, encoding=self.table.encoding)
except NameError:
# raise a nice message, ... | [
"where",
"can",
"be",
"a",
":",
"dict",
"list",
"tuple",
"string"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4679-L4699 | [
"def",
"generate",
"(",
"self",
",",
"where",
")",
":",
"if",
"where",
"is",
"None",
":",
"return",
"None",
"q",
"=",
"self",
".",
"table",
".",
"queryables",
"(",
")",
"try",
":",
"return",
"Expr",
"(",
"where",
",",
"queryables",
"=",
"q",
",",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Selection.select | generate the selection | pandas/io/pytables.py | def select(self):
"""
generate the selection
"""
if self.condition is not None:
return self.table.table.read_where(self.condition.format(),
start=self.start,
stop=self.stop)
... | def select(self):
"""
generate the selection
"""
if self.condition is not None:
return self.table.table.read_where(self.condition.format(),
start=self.start,
stop=self.stop)
... | [
"generate",
"the",
"selection"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4701-L4711 | [
"def",
"select",
"(",
"self",
")",
":",
"if",
"self",
".",
"condition",
"is",
"not",
"None",
":",
"return",
"self",
".",
"table",
".",
"table",
".",
"read_where",
"(",
"self",
".",
"condition",
".",
"format",
"(",
")",
",",
"start",
"=",
"self",
".... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | Selection.select_coords | generate the selection | pandas/io/pytables.py | def select_coords(self):
"""
generate the selection
"""
start, stop = self.start, self.stop
nrows = self.table.nrows
if start is None:
start = 0
elif start < 0:
start += nrows
if self.stop is None:
stop = nrows
e... | def select_coords(self):
"""
generate the selection
"""
start, stop = self.start, self.stop
nrows = self.table.nrows
if start is None:
start = 0
elif start < 0:
start += nrows
if self.stop is None:
stop = nrows
e... | [
"generate",
"the",
"selection"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4713-L4735 | [
"def",
"select_coords",
"(",
"self",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"start",
",",
"self",
".",
"stop",
"nrows",
"=",
"self",
".",
"table",
".",
"nrows",
"if",
"start",
"is",
"None",
":",
"start",
"=",
"0",
"elif",
"start",
"<",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.astype | Cast to a NumPy array with 'dtype'.
Parameters
----------
dtype : str or dtype
Typecode or data-type to which the array is cast.
copy : bool, default True
Whether to copy the data, even if not necessary. If False,
a copy is made only if the old dtype ... | pandas/core/arrays/base.py | def astype(self, dtype, copy=True):
"""
Cast to a NumPy array with 'dtype'.
Parameters
----------
dtype : str or dtype
Typecode or data-type to which the array is cast.
copy : bool, default True
Whether to copy the data, even if not necessary. If ... | def astype(self, dtype, copy=True):
"""
Cast to a NumPy array with 'dtype'.
Parameters
----------
dtype : str or dtype
Typecode or data-type to which the array is cast.
copy : bool, default True
Whether to copy the data, even if not necessary. If ... | [
"Cast",
"to",
"a",
"NumPy",
"array",
"with",
"dtype",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L322-L340 | [
"def",
"astype",
"(",
"self",
",",
"dtype",
",",
"copy",
"=",
"True",
")",
":",
"return",
"np",
".",
"array",
"(",
"self",
",",
"dtype",
"=",
"dtype",
",",
"copy",
"=",
"copy",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.argsort | Return the indices that would sort this array.
Parameters
----------
ascending : bool, default True
Whether the indices should result in an ascending
or descending sort.
kind : {'quicksort', 'mergesort', 'heapsort'}, optional
Sorting algorithm.
... | pandas/core/arrays/base.py | def argsort(self, ascending=True, kind='quicksort', *args, **kwargs):
"""
Return the indices that would sort this array.
Parameters
----------
ascending : bool, default True
Whether the indices should result in an ascending
or descending sort.
kin... | def argsort(self, ascending=True, kind='quicksort', *args, **kwargs):
"""
Return the indices that would sort this array.
Parameters
----------
ascending : bool, default True
Whether the indices should result in an ascending
or descending sort.
kin... | [
"Return",
"the",
"indices",
"that",
"would",
"sort",
"this",
"array",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L381-L413 | [
"def",
"argsort",
"(",
"self",
",",
"ascending",
"=",
"True",
",",
"kind",
"=",
"'quicksort'",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implementor note: You have two places to override the behavior of",
"# argsort.",
"# 1. _values_for_argsort : construct... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.fillna | Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, array-like
If a scalar value is passed it is used to fill all missing values.
Alternatively, an array-like 'value' can be given. It's expected
that the array-like have the sa... | pandas/core/arrays/base.py | def fillna(self, value=None, method=None, limit=None):
"""
Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, array-like
If a scalar value is passed it is used to fill all missing values.
Alternatively, an array-like 'val... | def fillna(self, value=None, method=None, limit=None):
"""
Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, array-like
If a scalar value is passed it is used to fill all missing values.
Alternatively, an array-like 'val... | [
"Fill",
"NA",
"/",
"NaN",
"values",
"using",
"the",
"specified",
"method",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L415-L467 | [
"def",
"fillna",
"(",
"self",
",",
"value",
"=",
"None",
",",
"method",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"from",
"pandas",
".",
"api",
".",
"types",
"import",
"is_array_like",
"from",
"pandas",
".",
"util",
".",
"_validators",
"import"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.shift | Shift values by desired number.
Newly introduced missing values are filled with
``self.dtype.na_value``.
.. versionadded:: 0.24.0
Parameters
----------
periods : int, default 1
The number of periods to shift. Negative values are allowed
for shif... | pandas/core/arrays/base.py | def shift(
self,
periods: int = 1,
fill_value: object = None,
) -> ABCExtensionArray:
"""
Shift values by desired number.
Newly introduced missing values are filled with
``self.dtype.na_value``.
.. versionadded:: 0.24.0
Parameter... | def shift(
self,
periods: int = 1,
fill_value: object = None,
) -> ABCExtensionArray:
"""
Shift values by desired number.
Newly introduced missing values are filled with
``self.dtype.na_value``.
.. versionadded:: 0.24.0
Parameter... | [
"Shift",
"values",
"by",
"desired",
"number",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L479-L535 | [
"def",
"shift",
"(",
"self",
",",
"periods",
":",
"int",
"=",
"1",
",",
"fill_value",
":",
"object",
"=",
"None",
",",
")",
"->",
"ABCExtensionArray",
":",
"# Note: this implementation assumes that `self.dtype.na_value` can be",
"# stored in an instance of your ExtensionA... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.unique | Compute the ExtensionArray of unique values.
Returns
-------
uniques : ExtensionArray | pandas/core/arrays/base.py | def unique(self):
"""
Compute the ExtensionArray of unique values.
Returns
-------
uniques : ExtensionArray
"""
from pandas import unique
uniques = unique(self.astype(object))
return self._from_sequence(uniques, dtype=self.dtype) | def unique(self):
"""
Compute the ExtensionArray of unique values.
Returns
-------
uniques : ExtensionArray
"""
from pandas import unique
uniques = unique(self.astype(object))
return self._from_sequence(uniques, dtype=self.dtype) | [
"Compute",
"the",
"ExtensionArray",
"of",
"unique",
"values",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L537-L548 | [
"def",
"unique",
"(",
"self",
")",
":",
"from",
"pandas",
"import",
"unique",
"uniques",
"=",
"unique",
"(",
"self",
".",
"astype",
"(",
"object",
")",
")",
"return",
"self",
".",
"_from_sequence",
"(",
"uniques",
",",
"dtype",
"=",
"self",
".",
"dtype... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.searchsorted | Find indices where elements should be inserted to maintain order.
.. versionadded:: 0.24.0
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the indices,
the order of `self` would be preserved.
Assuming tha... | pandas/core/arrays/base.py | def searchsorted(self, value, side="left", sorter=None):
"""
Find indices where elements should be inserted to maintain order.
.. versionadded:: 0.24.0
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the i... | def searchsorted(self, value, side="left", sorter=None):
"""
Find indices where elements should be inserted to maintain order.
.. versionadded:: 0.24.0
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the i... | [
"Find",
"indices",
"where",
"elements",
"should",
"be",
"inserted",
"to",
"maintain",
"order",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L550-L596 | [
"def",
"searchsorted",
"(",
"self",
",",
"value",
",",
"side",
"=",
"\"left\"",
",",
"sorter",
"=",
"None",
")",
":",
"# Note: the base tests provided by pandas only test the basics.",
"# We do not test",
"# 1. Values outside the range of the `data_for_sorting` fixture",
"# 2. ... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray._values_for_factorize | Return an array and missing value suitable for factorization.
Returns
-------
values : ndarray
An array suitable for factorization. This should maintain order
and be a supported dtype (Float64, Int64, UInt64, String, Object).
By default, the extension array ... | pandas/core/arrays/base.py | def _values_for_factorize(self) -> Tuple[np.ndarray, Any]:
"""
Return an array and missing value suitable for factorization.
Returns
-------
values : ndarray
An array suitable for factorization. This should maintain order
and be a supported dtype (Float6... | def _values_for_factorize(self) -> Tuple[np.ndarray, Any]:
"""
Return an array and missing value suitable for factorization.
Returns
-------
values : ndarray
An array suitable for factorization. This should maintain order
and be a supported dtype (Float6... | [
"Return",
"an",
"array",
"and",
"missing",
"value",
"suitable",
"for",
"factorization",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L598-L620 | [
"def",
"_values_for_factorize",
"(",
"self",
")",
"->",
"Tuple",
"[",
"np",
".",
"ndarray",
",",
"Any",
"]",
":",
"return",
"self",
".",
"astype",
"(",
"object",
")",
",",
"np",
".",
"nan"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.factorize | Encode the extension array as an enumerated type.
Parameters
----------
na_sentinel : int, default -1
Value to use in the `labels` array to indicate missing values.
Returns
-------
labels : ndarray
An integer NumPy array that's an indexer into th... | pandas/core/arrays/base.py | def factorize(
self,
na_sentinel: int = -1,
) -> Tuple[np.ndarray, ABCExtensionArray]:
"""
Encode the extension array as an enumerated type.
Parameters
----------
na_sentinel : int, default -1
Value to use in the `labels` array to indicate... | def factorize(
self,
na_sentinel: int = -1,
) -> Tuple[np.ndarray, ABCExtensionArray]:
"""
Encode the extension array as an enumerated type.
Parameters
----------
na_sentinel : int, default -1
Value to use in the `labels` array to indicate... | [
"Encode",
"the",
"extension",
"array",
"as",
"an",
"enumerated",
"type",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L622-L672 | [
"def",
"factorize",
"(",
"self",
",",
"na_sentinel",
":",
"int",
"=",
"-",
"1",
",",
")",
"->",
"Tuple",
"[",
"np",
".",
"ndarray",
",",
"ABCExtensionArray",
"]",
":",
"# Impelmentor note: There are two ways to override the behavior of",
"# pandas.factorize",
"# 1. ... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray.take | Take elements from an array.
Parameters
----------
indices : sequence of integers
Indices to be taken.
allow_fill : bool, default False
How to handle negative values in `indices`.
* False: negative values in `indices` indicate positional indices
... | pandas/core/arrays/base.py | def take(
self,
indices: Sequence[int],
allow_fill: bool = False,
fill_value: Any = None
) -> ABCExtensionArray:
"""
Take elements from an array.
Parameters
----------
indices : sequence of integers
Indices to be ta... | def take(
self,
indices: Sequence[int],
allow_fill: bool = False,
fill_value: Any = None
) -> ABCExtensionArray:
"""
Take elements from an array.
Parameters
----------
indices : sequence of integers
Indices to be ta... | [
"Take",
"elements",
"from",
"an",
"array",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L727-L819 | [
"def",
"take",
"(",
"self",
",",
"indices",
":",
"Sequence",
"[",
"int",
"]",
",",
"allow_fill",
":",
"bool",
"=",
"False",
",",
"fill_value",
":",
"Any",
"=",
"None",
")",
"->",
"ABCExtensionArray",
":",
"# Implementer note: The `fill_value` parameter should be... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray._formatter | Formatting function for scalar values.
This is used in the default '__repr__'. The returned formatting
function receives instances of your scalar type.
Parameters
----------
boxed: bool, default False
An indicated for whether or not your array is being printed
... | pandas/core/arrays/base.py | def _formatter(
self,
boxed: bool = False,
) -> Callable[[Any], Optional[str]]:
"""Formatting function for scalar values.
This is used in the default '__repr__'. The returned formatting
function receives instances of your scalar type.
Parameters
----... | def _formatter(
self,
boxed: bool = False,
) -> Callable[[Any], Optional[str]]:
"""Formatting function for scalar values.
This is used in the default '__repr__'. The returned formatting
function receives instances of your scalar type.
Parameters
----... | [
"Formatting",
"function",
"for",
"scalar",
"values",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L857-L885 | [
"def",
"_formatter",
"(",
"self",
",",
"boxed",
":",
"bool",
"=",
"False",
",",
")",
"->",
"Callable",
"[",
"[",
"Any",
"]",
",",
"Optional",
"[",
"str",
"]",
"]",
":",
"if",
"boxed",
":",
"return",
"str",
"return",
"repr"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionArray._reduce | Return a scalar result of performing the reduction operation.
Parameters
----------
name : str
Name of the function, supported values are:
{ any, all, min, max, sum, mean, median, prod,
std, var, sem, kurt, skew }.
skipna : bool, default True
... | pandas/core/arrays/base.py | def _reduce(self, name, skipna=True, **kwargs):
"""
Return a scalar result of performing the reduction operation.
Parameters
----------
name : str
Name of the function, supported values are:
{ any, all, min, max, sum, mean, median, prod,
std, ... | def _reduce(self, name, skipna=True, **kwargs):
"""
Return a scalar result of performing the reduction operation.
Parameters
----------
name : str
Name of the function, supported values are:
{ any, all, min, max, sum, mean, median, prod,
std, ... | [
"Return",
"a",
"scalar",
"result",
"of",
"performing",
"the",
"reduction",
"operation",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L939-L964 | [
"def",
"_reduce",
"(",
"self",
",",
"name",
",",
"skipna",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"TypeError",
"(",
"\"cannot perform {name} with type {dtype}\"",
".",
"format",
"(",
"name",
"=",
"name",
",",
"dtype",
"=",
"self",
".",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ExtensionScalarOpsMixin._create_method | A class method that returns a method that will correspond to an
operator for an ExtensionArray subclass, by dispatching to the
relevant operator defined on the individual elements of the
ExtensionArray.
Parameters
----------
op : function
An operator that tak... | pandas/core/arrays/base.py | def _create_method(cls, op, coerce_to_dtype=True):
"""
A class method that returns a method that will correspond to an
operator for an ExtensionArray subclass, by dispatching to the
relevant operator defined on the individual elements of the
ExtensionArray.
Parameters
... | def _create_method(cls, op, coerce_to_dtype=True):
"""
A class method that returns a method that will correspond to an
operator for an ExtensionArray subclass, by dispatching to the
relevant operator defined on the individual elements of the
ExtensionArray.
Parameters
... | [
"A",
"class",
"method",
"that",
"returns",
"a",
"method",
"that",
"will",
"correspond",
"to",
"an",
"operator",
"for",
"an",
"ExtensionArray",
"subclass",
"by",
"dispatching",
"to",
"the",
"relevant",
"operator",
"defined",
"on",
"the",
"individual",
"elements",... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L1034-L1113 | [
"def",
"_create_method",
"(",
"cls",
",",
"op",
",",
"coerce_to_dtype",
"=",
"True",
")",
":",
"def",
"_binop",
"(",
"self",
",",
"other",
")",
":",
"def",
"convert_values",
"(",
"param",
")",
":",
"if",
"isinstance",
"(",
"param",
",",
"ExtensionArray",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | ea_passthrough | Make an alias for a method of the underlying ExtensionArray.
Parameters
----------
array_method : method on an Array class
Returns
-------
method | pandas/core/indexes/datetimelike.py | def ea_passthrough(array_method):
"""
Make an alias for a method of the underlying ExtensionArray.
Parameters
----------
array_method : method on an Array class
Returns
-------
method
"""
def method(self, *args, **kwargs):
return array_method(self._data, *args, **kwarg... | def ea_passthrough(array_method):
"""
Make an alias for a method of the underlying ExtensionArray.
Parameters
----------
array_method : method on an Array class
Returns
-------
method
"""
def method(self, *args, **kwargs):
return array_method(self._data, *args, **kwarg... | [
"Make",
"an",
"alias",
"for",
"a",
"method",
"of",
"the",
"underlying",
"ExtensionArray",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L34-L52 | [
"def",
"ea_passthrough",
"(",
"array_method",
")",
":",
"def",
"method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"array_method",
"(",
"self",
".",
"_data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"method",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._create_comparison_method | Create a comparison method that dispatches to ``cls.values``. | pandas/core/indexes/datetimelike.py | def _create_comparison_method(cls, op):
"""
Create a comparison method that dispatches to ``cls.values``.
"""
def wrapper(self, other):
if isinstance(other, ABCSeries):
# the arrays defer to Series for comparison ops but the indexes
# don't, s... | def _create_comparison_method(cls, op):
"""
Create a comparison method that dispatches to ``cls.values``.
"""
def wrapper(self, other):
if isinstance(other, ABCSeries):
# the arrays defer to Series for comparison ops but the indexes
# don't, s... | [
"Create",
"a",
"comparison",
"method",
"that",
"dispatches",
"to",
"cls",
".",
"values",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L107-L122 | [
"def",
"_create_comparison_method",
"(",
"cls",
",",
"op",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"ABCSeries",
")",
":",
"# the arrays defer to Series for comparison ops but the indexes",
"# don't, so... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.equals | Determines if two Index objects contain the same elements. | pandas/core/indexes/datetimelike.py | def equals(self, other):
"""
Determines if two Index objects contain the same elements.
"""
if self.is_(other):
return True
if not isinstance(other, ABCIndexClass):
return False
elif not isinstance(other, type(self)):
try:
... | def equals(self, other):
"""
Determines if two Index objects contain the same elements.
"""
if self.is_(other):
return True
if not isinstance(other, ABCIndexClass):
return False
elif not isinstance(other, type(self)):
try:
... | [
"Determines",
"if",
"two",
"Index",
"objects",
"contain",
"the",
"same",
"elements",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L143-L168 | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"is_",
"(",
"other",
")",
":",
"return",
"True",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ABCIndexClass",
")",
":",
"return",
"False",
"elif",
"not",
"isinstance",
"(",
"o... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._join_i8_wrapper | Create the join wrapper methods. | pandas/core/indexes/datetimelike.py | def _join_i8_wrapper(joinf, dtype, with_indexers=True):
"""
Create the join wrapper methods.
"""
from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
@staticmethod
def wrapper(left, right):
if isinstance(left, (np.ndarray, ABCIndex, ABCSeries,
... | def _join_i8_wrapper(joinf, dtype, with_indexers=True):
"""
Create the join wrapper methods.
"""
from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
@staticmethod
def wrapper(left, right):
if isinstance(left, (np.ndarray, ABCIndex, ABCSeries,
... | [
"Create",
"the",
"join",
"wrapper",
"methods",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L171-L192 | [
"def",
"_join_i8_wrapper",
"(",
"joinf",
",",
"dtype",
",",
"with_indexers",
"=",
"True",
")",
":",
"from",
"pandas",
".",
"core",
".",
"arrays",
".",
"datetimelike",
"import",
"DatetimeLikeArrayMixin",
"@",
"staticmethod",
"def",
"wrapper",
"(",
"left",
",",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.sort_values | Return sorted copy of Index. | pandas/core/indexes/datetimelike.py | def sort_values(self, return_indexer=False, ascending=True):
"""
Return sorted copy of Index.
"""
if return_indexer:
_as = self.argsort()
if not ascending:
_as = _as[::-1]
sorted_index = self.take(_as)
return sorted_index, _... | def sort_values(self, return_indexer=False, ascending=True):
"""
Return sorted copy of Index.
"""
if return_indexer:
_as = self.argsort()
if not ascending:
_as = _as[::-1]
sorted_index = self.take(_as)
return sorted_index, _... | [
"Return",
"sorted",
"copy",
"of",
"Index",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L236-L261 | [
"def",
"sort_values",
"(",
"self",
",",
"return_indexer",
"=",
"False",
",",
"ascending",
"=",
"True",
")",
":",
"if",
"return_indexer",
":",
"_as",
"=",
"self",
".",
"argsort",
"(",
")",
"if",
"not",
"ascending",
":",
"_as",
"=",
"_as",
"[",
":",
":... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.min | Return the minimum value of the Index or minimum along
an axis.
See Also
--------
numpy.ndarray.min
Series.min : Return the minimum value in a Series. | pandas/core/indexes/datetimelike.py | def min(self, axis=None, skipna=True, *args, **kwargs):
"""
Return the minimum value of the Index or minimum along
an axis.
See Also
--------
numpy.ndarray.min
Series.min : Return the minimum value in a Series.
"""
nv.validate_min(args, kwargs)
... | def min(self, axis=None, skipna=True, *args, **kwargs):
"""
Return the minimum value of the Index or minimum along
an axis.
See Also
--------
numpy.ndarray.min
Series.min : Return the minimum value in a Series.
"""
nv.validate_min(args, kwargs)
... | [
"Return",
"the",
"minimum",
"value",
"of",
"the",
"Index",
"or",
"minimum",
"along",
"an",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L315-L347 | [
"def",
"min",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_min",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.argmin | Returns the indices of the minimum values along an axis.
See `numpy.ndarray.argmin` for more information on the
`axis` parameter.
See Also
--------
numpy.ndarray.argmin | pandas/core/indexes/datetimelike.py | def argmin(self, axis=None, skipna=True, *args, **kwargs):
"""
Returns the indices of the minimum values along an axis.
See `numpy.ndarray.argmin` for more information on the
`axis` parameter.
See Also
--------
numpy.ndarray.argmin
"""
nv.validat... | def argmin(self, axis=None, skipna=True, *args, **kwargs):
"""
Returns the indices of the minimum values along an axis.
See `numpy.ndarray.argmin` for more information on the
`axis` parameter.
See Also
--------
numpy.ndarray.argmin
"""
nv.validat... | [
"Returns",
"the",
"indices",
"of",
"the",
"minimum",
"values",
"along",
"an",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L349-L370 | [
"def",
"argmin",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_argmin",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.max | Return the maximum value of the Index or maximum along
an axis.
See Also
--------
numpy.ndarray.max
Series.max : Return the maximum value in a Series. | pandas/core/indexes/datetimelike.py | def max(self, axis=None, skipna=True, *args, **kwargs):
"""
Return the maximum value of the Index or maximum along
an axis.
See Also
--------
numpy.ndarray.max
Series.max : Return the maximum value in a Series.
"""
nv.validate_max(args, kwargs)
... | def max(self, axis=None, skipna=True, *args, **kwargs):
"""
Return the maximum value of the Index or maximum along
an axis.
See Also
--------
numpy.ndarray.max
Series.max : Return the maximum value in a Series.
"""
nv.validate_max(args, kwargs)
... | [
"Return",
"the",
"maximum",
"value",
"of",
"the",
"Index",
"or",
"maximum",
"along",
"an",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L372-L404 | [
"def",
"max",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_max",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.argmax | Returns the indices of the maximum values along an axis.
See `numpy.ndarray.argmax` for more information on the
`axis` parameter.
See Also
--------
numpy.ndarray.argmax | pandas/core/indexes/datetimelike.py | def argmax(self, axis=None, skipna=True, *args, **kwargs):
"""
Returns the indices of the maximum values along an axis.
See `numpy.ndarray.argmax` for more information on the
`axis` parameter.
See Also
--------
numpy.ndarray.argmax
"""
nv.validat... | def argmax(self, axis=None, skipna=True, *args, **kwargs):
"""
Returns the indices of the maximum values along an axis.
See `numpy.ndarray.argmax` for more information on the
`axis` parameter.
See Also
--------
numpy.ndarray.argmax
"""
nv.validat... | [
"Returns",
"the",
"indices",
"of",
"the",
"maximum",
"values",
"along",
"an",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L406-L427 | [
"def",
"argmax",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_argmax",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._format_attrs | Return a list of tuples of the (attr,formatted_value). | pandas/core/indexes/datetimelike.py | def _format_attrs(self):
"""
Return a list of tuples of the (attr,formatted_value).
"""
attrs = super()._format_attrs()
for attrib in self._attributes:
if attrib == 'freq':
freq = self.freqstr
if freq is not None:
fr... | def _format_attrs(self):
"""
Return a list of tuples of the (attr,formatted_value).
"""
attrs = super()._format_attrs()
for attrib in self._attributes:
if attrib == 'freq':
freq = self.freqstr
if freq is not None:
fr... | [
"Return",
"a",
"list",
"of",
"tuples",
"of",
"the",
"(",
"attr",
"formatted_value",
")",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L439-L450 | [
"def",
"_format_attrs",
"(",
"self",
")",
":",
"attrs",
"=",
"super",
"(",
")",
".",
"_format_attrs",
"(",
")",
"for",
"attrib",
"in",
"self",
".",
"_attributes",
":",
"if",
"attrib",
"==",
"'freq'",
":",
"freq",
"=",
"self",
".",
"freqstr",
"if",
"f... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._convert_scalar_indexer | We don't allow integer or float indexing on datetime-like when using
loc.
Parameters
----------
key : label of the slice bound
kind : {'ix', 'loc', 'getitem', 'iloc'} or None | pandas/core/indexes/datetimelike.py | def _convert_scalar_indexer(self, key, kind=None):
"""
We don't allow integer or float indexing on datetime-like when using
loc.
Parameters
----------
key : label of the slice bound
kind : {'ix', 'loc', 'getitem', 'iloc'} or None
"""
assert kind ... | def _convert_scalar_indexer(self, key, kind=None):
"""
We don't allow integer or float indexing on datetime-like when using
loc.
Parameters
----------
key : label of the slice bound
kind : {'ix', 'loc', 'getitem', 'iloc'} or None
"""
assert kind ... | [
"We",
"don",
"t",
"allow",
"integer",
"or",
"float",
"indexing",
"on",
"datetime",
"-",
"like",
"when",
"using",
"loc",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L454-L477 | [
"def",
"_convert_scalar_indexer",
"(",
"self",
",",
"key",
",",
"kind",
"=",
"None",
")",
":",
"assert",
"kind",
"in",
"[",
"'ix'",
",",
"'loc'",
",",
"'getitem'",
",",
"'iloc'",
",",
"None",
"]",
"# we don't allow integer/float indexing for loc",
"# we don't al... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._add_datetimelike_methods | Add in the datetimelike methods (as we may have to override the
superclass). | pandas/core/indexes/datetimelike.py | def _add_datetimelike_methods(cls):
"""
Add in the datetimelike methods (as we may have to override the
superclass).
"""
def __add__(self, other):
# dispatch to ExtensionArray implementation
result = self._data.__add__(maybe_unwrap_index(other))
... | def _add_datetimelike_methods(cls):
"""
Add in the datetimelike methods (as we may have to override the
superclass).
"""
def __add__(self, other):
# dispatch to ExtensionArray implementation
result = self._data.__add__(maybe_unwrap_index(other))
... | [
"Add",
"in",
"the",
"datetimelike",
"methods",
"(",
"as",
"we",
"may",
"have",
"to",
"override",
"the",
"superclass",
")",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L480-L509 | [
"def",
"_add_datetimelike_methods",
"(",
"cls",
")",
":",
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"# dispatch to ExtensionArray implementation",
"result",
"=",
"self",
".",
"_data",
".",
"__add__",
"(",
"maybe_unwrap_index",
"(",
"other",
")",
")"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.isin | Compute boolean array of whether each index value is found in the
passed set of values.
Parameters
----------
values : set or sequence of values
Returns
-------
is_contained : ndarray (boolean dtype) | pandas/core/indexes/datetimelike.py | def isin(self, values):
"""
Compute boolean array of whether each index value is found in the
passed set of values.
Parameters
----------
values : set or sequence of values
Returns
-------
is_contained : ndarray (boolean dtype)
"""
... | def isin(self, values):
"""
Compute boolean array of whether each index value is found in the
passed set of values.
Parameters
----------
values : set or sequence of values
Returns
-------
is_contained : ndarray (boolean dtype)
"""
... | [
"Compute",
"boolean",
"array",
"of",
"whether",
"each",
"index",
"value",
"is",
"found",
"in",
"the",
"passed",
"set",
"of",
"values",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L511-L530 | [
"def",
"isin",
"(",
"self",
",",
"values",
")",
":",
"if",
"not",
"isinstance",
"(",
"values",
",",
"type",
"(",
"self",
")",
")",
":",
"try",
":",
"values",
"=",
"type",
"(",
"self",
")",
"(",
"values",
")",
"except",
"ValueError",
":",
"return",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._summary | Return a summarized representation.
Parameters
----------
name : str
name to use in the summary representation
Returns
-------
String with a summarized representation of the index | pandas/core/indexes/datetimelike.py | def _summary(self, name=None):
"""
Return a summarized representation.
Parameters
----------
name : str
name to use in the summary representation
Returns
-------
String with a summarized representation of the index
"""
formatt... | def _summary(self, name=None):
"""
Return a summarized representation.
Parameters
----------
name : str
name to use in the summary representation
Returns
-------
String with a summarized representation of the index
"""
formatt... | [
"Return",
"a",
"summarized",
"representation",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L547-L576 | [
"def",
"_summary",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"formatter",
"=",
"self",
".",
"_formatter_func",
"if",
"len",
"(",
"self",
")",
">",
"0",
":",
"index_summary",
"=",
"', %s to %s'",
"%",
"(",
"formatter",
"(",
"self",
"[",
"0",
"]... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin._concat_same_dtype | Concatenate to_concat which has the same class. | pandas/core/indexes/datetimelike.py | def _concat_same_dtype(self, to_concat, name):
"""
Concatenate to_concat which has the same class.
"""
attribs = self._get_attributes_dict()
attribs['name'] = name
# do not pass tz to set because tzlocal cannot be hashed
if len({str(x.dtype) for x in to_concat}) !... | def _concat_same_dtype(self, to_concat, name):
"""
Concatenate to_concat which has the same class.
"""
attribs = self._get_attributes_dict()
attribs['name'] = name
# do not pass tz to set because tzlocal cannot be hashed
if len({str(x.dtype) for x in to_concat}) !... | [
"Concatenate",
"to_concat",
"which",
"has",
"the",
"same",
"class",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L578-L597 | [
"def",
"_concat_same_dtype",
"(",
"self",
",",
"to_concat",
",",
"name",
")",
":",
"attribs",
"=",
"self",
".",
"_get_attributes_dict",
"(",
")",
"attribs",
"[",
"'name'",
"]",
"=",
"name",
"# do not pass tz to set because tzlocal cannot be hashed",
"if",
"len",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | DatetimeIndexOpsMixin.shift | Shift index by desired number of time frequency increments.
This method is for shifting the values of datetime-like indexes
by a specified time increment a given number of times.
Parameters
----------
periods : int
Number of periods (or increments) to shift by,
... | pandas/core/indexes/datetimelike.py | def shift(self, periods, freq=None):
"""
Shift index by desired number of time frequency increments.
This method is for shifting the values of datetime-like indexes
by a specified time increment a given number of times.
Parameters
----------
periods : int
... | def shift(self, periods, freq=None):
"""
Shift index by desired number of time frequency increments.
This method is for shifting the values of datetime-like indexes
by a specified time increment a given number of times.
Parameters
----------
periods : int
... | [
"Shift",
"index",
"by",
"desired",
"number",
"of",
"time",
"frequency",
"increments",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L613-L644 | [
"def",
"shift",
"(",
"self",
",",
"periods",
",",
"freq",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"_data",
".",
"_time_shift",
"(",
"periods",
",",
"freq",
"=",
"freq",
")",
"return",
"type",
"(",
"self",
")",
"(",
"result",
",",
"name",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _single_replace | Replaces values in a Series using the fill method specified when no
replacement value is given in the replace method | pandas/core/generic.py | def _single_replace(self, to_replace, method, inplace, limit):
"""
Replaces values in a Series using the fill method specified when no
replacement value is given in the replace method
"""
if self.ndim != 1:
raise TypeError('cannot replace {0} with method {1} on a {2}'
... | def _single_replace(self, to_replace, method, inplace, limit):
"""
Replaces values in a Series using the fill method specified when no
replacement value is given in the replace method
"""
if self.ndim != 1:
raise TypeError('cannot replace {0} with method {1} on a {2}'
... | [
"Replaces",
"values",
"in",
"a",
"Series",
"using",
"the",
"fill",
"method",
"specified",
"when",
"no",
"replacement",
"value",
"is",
"given",
"in",
"the",
"replace",
"method"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L69-L95 | [
"def",
"_single_replace",
"(",
"self",
",",
"to_replace",
",",
"method",
",",
"inplace",
",",
"limit",
")",
":",
"if",
"self",
".",
"ndim",
"!=",
"1",
":",
"raise",
"TypeError",
"(",
"'cannot replace {0} with method {1} on a {2}'",
".",
"format",
"(",
"to_repl... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | _doc_parms | Return a tuple of the doc parms. | pandas/core/generic.py | def _doc_parms(cls):
"""Return a tuple of the doc parms."""
axis_descr = "{%s}" % ', '.join("{0} ({1})".format(a, i)
for i, a in enumerate(cls._AXIS_ORDERS))
name = (cls._constructor_sliced.__name__
if cls._AXIS_LEN > 1 else 'scalar')
name2 = cls.__name__
... | def _doc_parms(cls):
"""Return a tuple of the doc parms."""
axis_descr = "{%s}" % ', '.join("{0} ({1})".format(a, i)
for i, a in enumerate(cls._AXIS_ORDERS))
name = (cls._constructor_sliced.__name__
if cls._AXIS_LEN > 1 else 'scalar')
name2 = cls.__name__
... | [
"Return",
"a",
"tuple",
"of",
"the",
"doc",
"parms",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10299-L10306 | [
"def",
"_doc_parms",
"(",
"cls",
")",
":",
"axis_descr",
"=",
"\"{%s}\"",
"%",
"', '",
".",
"join",
"(",
"\"{0} ({1})\"",
".",
"format",
"(",
"a",
",",
"i",
")",
"for",
"i",
",",
"a",
"in",
"enumerate",
"(",
"cls",
".",
"_AXIS_ORDERS",
")",
")",
"n... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._init_mgr | passed a manager and a axes dict | pandas/core/generic.py | def _init_mgr(self, mgr, axes=None, dtype=None, copy=False):
""" passed a manager and a axes dict """
for a, axe in axes.items():
if axe is not None:
mgr = mgr.reindex_axis(axe,
axis=self._get_block_manager_axis(a),
... | def _init_mgr(self, mgr, axes=None, dtype=None, copy=False):
""" passed a manager and a axes dict """
for a, axe in axes.items():
if axe is not None:
mgr = mgr.reindex_axis(axe,
axis=self._get_block_manager_axis(a),
... | [
"passed",
"a",
"manager",
"and",
"a",
"axes",
"dict"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L141-L156 | [
"def",
"_init_mgr",
"(",
"self",
",",
"mgr",
",",
"axes",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"for",
"a",
",",
"axe",
"in",
"axes",
".",
"items",
"(",
")",
":",
"if",
"axe",
"is",
"not",
"None",
":",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._validate_dtype | validate the passed dtype | pandas/core/generic.py | def _validate_dtype(self, dtype):
""" validate the passed dtype """
if dtype is not None:
dtype = pandas_dtype(dtype)
# a compound dtype
if dtype.kind == 'V':
raise NotImplementedError("compound dtypes are not implemented"
... | def _validate_dtype(self, dtype):
""" validate the passed dtype """
if dtype is not None:
dtype = pandas_dtype(dtype)
# a compound dtype
if dtype.kind == 'V':
raise NotImplementedError("compound dtypes are not implemented"
... | [
"validate",
"the",
"passed",
"dtype"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L175-L187 | [
"def",
"_validate_dtype",
"(",
"self",
",",
"dtype",
")",
":",
"if",
"dtype",
"is",
"not",
"None",
":",
"dtype",
"=",
"pandas_dtype",
"(",
"dtype",
")",
"# a compound dtype",
"if",
"dtype",
".",
"kind",
"==",
"'V'",
":",
"raise",
"NotImplementedError",
"("... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._setup_axes | Provide axes setup for the major PandasObjects.
Parameters
----------
axes : the names of the axes in order (lowest to highest)
info_axis_num : the axis of the selector dimension (int)
stat_axis_num : the number of axis for the default stats (int)
aliases : other names f... | pandas/core/generic.py | def _setup_axes(cls, axes, info_axis=None, stat_axis=None, aliases=None,
slicers=None, axes_are_reversed=False, build_axes=True,
ns=None, docs=None):
"""Provide axes setup for the major PandasObjects.
Parameters
----------
axes : the names of the ... | def _setup_axes(cls, axes, info_axis=None, stat_axis=None, aliases=None,
slicers=None, axes_are_reversed=False, build_axes=True,
ns=None, docs=None):
"""Provide axes setup for the major PandasObjects.
Parameters
----------
axes : the names of the ... | [
"Provide",
"axes",
"setup",
"for",
"the",
"major",
"PandasObjects",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L217-L272 | [
"def",
"_setup_axes",
"(",
"cls",
",",
"axes",
",",
"info_axis",
"=",
"None",
",",
"stat_axis",
"=",
"None",
",",
"aliases",
"=",
"None",
",",
"slicers",
"=",
"None",
",",
"axes_are_reversed",
"=",
"False",
",",
"build_axes",
"=",
"True",
",",
"ns",
"=... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._construct_axes_dict | Return an axes dictionary for myself. | pandas/core/generic.py | def _construct_axes_dict(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {a: self._get_axis(a) for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | def _construct_axes_dict(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {a: self._get_axis(a) for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | [
"Return",
"an",
"axes",
"dictionary",
"for",
"myself",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L274-L278 | [
"def",
"_construct_axes_dict",
"(",
"self",
",",
"axes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"a",
":",
"self",
".",
"_get_axis",
"(",
"a",
")",
"for",
"a",
"in",
"(",
"axes",
"or",
"self",
".",
"_AXIS_ORDERS",
")",
"}",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._construct_axes_dict_from | Return an axes dictionary for the passed axes. | pandas/core/generic.py | def _construct_axes_dict_from(self, axes, **kwargs):
"""Return an axes dictionary for the passed axes."""
d = {a: ax for a, ax in zip(self._AXIS_ORDERS, axes)}
d.update(kwargs)
return d | def _construct_axes_dict_from(self, axes, **kwargs):
"""Return an axes dictionary for the passed axes."""
d = {a: ax for a, ax in zip(self._AXIS_ORDERS, axes)}
d.update(kwargs)
return d | [
"Return",
"an",
"axes",
"dictionary",
"for",
"the",
"passed",
"axes",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L281-L285 | [
"def",
"_construct_axes_dict_from",
"(",
"self",
",",
"axes",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"a",
":",
"ax",
"for",
"a",
",",
"ax",
"in",
"zip",
"(",
"self",
".",
"_AXIS_ORDERS",
",",
"axes",
")",
"}",
"d",
".",
"update",
"(",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._construct_axes_dict_for_slice | Return an axes dictionary for myself. | pandas/core/generic.py | def _construct_axes_dict_for_slice(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {self._AXIS_SLICEMAP[a]: self._get_axis(a)
for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | def _construct_axes_dict_for_slice(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {self._AXIS_SLICEMAP[a]: self._get_axis(a)
for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | [
"Return",
"an",
"axes",
"dictionary",
"for",
"myself",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L287-L292 | [
"def",
"_construct_axes_dict_for_slice",
"(",
"self",
",",
"axes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"self",
".",
"_AXIS_SLICEMAP",
"[",
"a",
"]",
":",
"self",
".",
"_get_axis",
"(",
"a",
")",
"for",
"a",
"in",
"(",
"ax... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._construct_axes_from_arguments | Construct and returns axes if supplied in args/kwargs.
If require_all, raise if all axis arguments are not supplied
return a tuple of (axes, kwargs).
sentinel specifies the default parameter when an axis is not
supplied; useful to distinguish when a user explicitly passes None
... | pandas/core/generic.py | def _construct_axes_from_arguments(
self, args, kwargs, require_all=False, sentinel=None):
"""Construct and returns axes if supplied in args/kwargs.
If require_all, raise if all axis arguments are not supplied
return a tuple of (axes, kwargs).
sentinel specifies the default... | def _construct_axes_from_arguments(
self, args, kwargs, require_all=False, sentinel=None):
"""Construct and returns axes if supplied in args/kwargs.
If require_all, raise if all axis arguments are not supplied
return a tuple of (axes, kwargs).
sentinel specifies the default... | [
"Construct",
"and",
"returns",
"axes",
"if",
"supplied",
"in",
"args",
"/",
"kwargs",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L294-L332 | [
"def",
"_construct_axes_from_arguments",
"(",
"self",
",",
"args",
",",
"kwargs",
",",
"require_all",
"=",
"False",
",",
"sentinel",
"=",
"None",
")",
":",
"# construct the args",
"args",
"=",
"list",
"(",
"args",
")",
"for",
"a",
"in",
"self",
".",
"_AXIS... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._get_block_manager_axis | Map the axis to the block_manager axis. | pandas/core/generic.py | def _get_block_manager_axis(cls, axis):
"""Map the axis to the block_manager axis."""
axis = cls._get_axis_number(axis)
if cls._AXIS_REVERSED:
m = cls._AXIS_LEN - 1
return m - axis
return axis | def _get_block_manager_axis(cls, axis):
"""Map the axis to the block_manager axis."""
axis = cls._get_axis_number(axis)
if cls._AXIS_REVERSED:
m = cls._AXIS_LEN - 1
return m - axis
return axis | [
"Map",
"the",
"axis",
"to",
"the",
"block_manager",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L379-L385 | [
"def",
"_get_block_manager_axis",
"(",
"cls",
",",
"axis",
")",
":",
"axis",
"=",
"cls",
".",
"_get_axis_number",
"(",
"axis",
")",
"if",
"cls",
".",
"_AXIS_REVERSED",
":",
"m",
"=",
"cls",
".",
"_AXIS_LEN",
"-",
"1",
"return",
"m",
"-",
"axis",
"retur... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._get_space_character_free_column_resolvers | Return the space character free column resolvers of a dataframe.
Column names with spaces are 'cleaned up' so that they can be referred
to by backtick quoting.
Used in :meth:`DataFrame.eval`. | pandas/core/generic.py | def _get_space_character_free_column_resolvers(self):
"""Return the space character free column resolvers of a dataframe.
Column names with spaces are 'cleaned up' so that they can be referred
to by backtick quoting.
Used in :meth:`DataFrame.eval`.
"""
from pandas.core.c... | def _get_space_character_free_column_resolvers(self):
"""Return the space character free column resolvers of a dataframe.
Column names with spaces are 'cleaned up' so that they can be referred
to by backtick quoting.
Used in :meth:`DataFrame.eval`.
"""
from pandas.core.c... | [
"Return",
"the",
"space",
"character",
"free",
"column",
"resolvers",
"of",
"a",
"dataframe",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L423-L433 | [
"def",
"_get_space_character_free_column_resolvers",
"(",
"self",
")",
":",
"from",
"pandas",
".",
"core",
".",
"computation",
".",
"common",
"import",
"_remove_spaces_column_name",
"return",
"{",
"_remove_spaces_column_name",
"(",
"k",
")",
":",
"v",
"for",
"k",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.shape | Return a tuple of axis dimensions | pandas/core/generic.py | def shape(self):
"""
Return a tuple of axis dimensions
"""
return tuple(len(self._get_axis(a)) for a in self._AXIS_ORDERS) | def shape(self):
"""
Return a tuple of axis dimensions
"""
return tuple(len(self._get_axis(a)) for a in self._AXIS_ORDERS) | [
"Return",
"a",
"tuple",
"of",
"axis",
"dimensions"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L444-L448 | [
"def",
"shape",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"len",
"(",
"self",
".",
"_get_axis",
"(",
"a",
")",
")",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.transpose | Permute the dimensions of the %(klass)s
Parameters
----------
args : %(args_transpose)s
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
**kwargs
Additional keyword arguments will ... | pandas/core/generic.py | def transpose(self, *args, **kwargs):
"""
Permute the dimensions of the %(klass)s
Parameters
----------
args : %(args_transpose)s
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
... | def transpose(self, *args, **kwargs):
"""
Permute the dimensions of the %(klass)s
Parameters
----------
args : %(args_transpose)s
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
... | [
"Permute",
"the",
"dimensions",
"of",
"the",
"%",
"(",
"klass",
")",
"s"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L650-L692 | [
"def",
"transpose",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# construct the args",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"args",
",",
"kwargs",
",",
"require_all",
"=",
"True",
")",
"axes... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.swapaxes | Interchange axes and swap values axes appropriately.
Returns
-------
y : same as input | pandas/core/generic.py | def swapaxes(self, axis1, axis2, copy=True):
"""
Interchange axes and swap values axes appropriately.
Returns
-------
y : same as input
"""
i = self._get_axis_number(axis1)
j = self._get_axis_number(axis2)
if i == j:
if copy:
... | def swapaxes(self, axis1, axis2, copy=True):
"""
Interchange axes and swap values axes appropriately.
Returns
-------
y : same as input
"""
i = self._get_axis_number(axis1)
j = self._get_axis_number(axis2)
if i == j:
if copy:
... | [
"Interchange",
"axes",
"and",
"swap",
"values",
"axes",
"appropriately",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L694-L718 | [
"def",
"swapaxes",
"(",
"self",
",",
"axis1",
",",
"axis2",
",",
"copy",
"=",
"True",
")",
":",
"i",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis1",
")",
"j",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis2",
")",
"if",
"i",
"==",
"j",
":",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.droplevel | Return DataFrame with requested index / column level(s) removed.
.. versionadded:: 0.24.0
Parameters
----------
level : int, str, or list-like
If a string is given, must be the name of a level
If list-like, elements must be names or positional indexes
... | pandas/core/generic.py | def droplevel(self, level, axis=0):
"""
Return DataFrame with requested index / column level(s) removed.
.. versionadded:: 0.24.0
Parameters
----------
level : int, str, or list-like
If a string is given, must be the name of a level
If list-like,... | def droplevel(self, level, axis=0):
"""
Return DataFrame with requested index / column level(s) removed.
.. versionadded:: 0.24.0
Parameters
----------
level : int, str, or list-like
If a string is given, must be the name of a level
If list-like,... | [
"Return",
"DataFrame",
"with",
"requested",
"index",
"/",
"column",
"level",
"(",
"s",
")",
"removed",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L720-L777 | [
"def",
"droplevel",
"(",
"self",
",",
"level",
",",
"axis",
"=",
"0",
")",
":",
"labels",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
")",
"new_labels",
"=",
"labels",
".",
"droplevel",
"(",
"level",
")",
"result",
"=",
"self",
".",
"set_axis",
"(",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.pop | Return item and drop from frame. Raise KeyError if not found.
Parameters
----------
item : str
Label of column to be popped.
Returns
-------
Series
Examples
--------
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
... ... | pandas/core/generic.py | def pop(self, item):
"""
Return item and drop from frame. Raise KeyError if not found.
Parameters
----------
item : str
Label of column to be popped.
Returns
-------
Series
Examples
--------
>>> df = pd.DataFrame([('f... | def pop(self, item):
"""
Return item and drop from frame. Raise KeyError if not found.
Parameters
----------
item : str
Label of column to be popped.
Returns
-------
Series
Examples
--------
>>> df = pd.DataFrame([('f... | [
"Return",
"item",
"and",
"drop",
"from",
"frame",
".",
"Raise",
"KeyError",
"if",
"not",
"found",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L779-L827 | [
"def",
"pop",
"(",
"self",
",",
"item",
")",
":",
"result",
"=",
"self",
"[",
"item",
"]",
"del",
"self",
"[",
"item",
"]",
"try",
":",
"result",
".",
"_reset_cacher",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"return",
"result"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.squeeze | Squeeze 1 dimensional axis objects into scalars.
Series or DataFrames with a single element are squeezed to a scalar.
DataFrames with a single column or a single row are squeezed to a
Series. Otherwise the object is unchanged.
This method is most useful when you don't know if your
... | pandas/core/generic.py | def squeeze(self, axis=None):
"""
Squeeze 1 dimensional axis objects into scalars.
Series or DataFrames with a single element are squeezed to a scalar.
DataFrames with a single column or a single row are squeezed to a
Series. Otherwise the object is unchanged.
This meth... | def squeeze(self, axis=None):
"""
Squeeze 1 dimensional axis objects into scalars.
Series or DataFrames with a single element are squeezed to a scalar.
DataFrames with a single column or a single row are squeezed to a
Series. Otherwise the object is unchanged.
This meth... | [
"Squeeze",
"1",
"dimensional",
"axis",
"objects",
"into",
"scalars",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L829-L941 | [
"def",
"squeeze",
"(",
"self",
",",
"axis",
"=",
"None",
")",
":",
"axis",
"=",
"(",
"self",
".",
"_AXIS_NAMES",
"if",
"axis",
"is",
"None",
"else",
"(",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
",",
")",
")",
"try",
":",
"return",
"self"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.swaplevel | Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : same type as caller (new object)
.. versionchanged::... | pandas/core/generic.py | def swaplevel(self, i=-2, j=-1, axis=0):
"""
Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : ... | def swaplevel(self, i=-2, j=-1, axis=0):
"""
Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : ... | [
"Swap",
"levels",
"i",
"and",
"j",
"in",
"a",
"MultiIndex",
"on",
"a",
"particular",
"axis"
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L943-L965 | [
"def",
"swaplevel",
"(",
"self",
",",
"i",
"=",
"-",
"2",
",",
"j",
"=",
"-",
"1",
",",
"axis",
"=",
"0",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"result",
"=",
"self",
".",
"copy",
"(",
")",
"labels",
"=",
"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.rename | Alter axes input function or functions. Function / dict values must be
unique (1-to-1). Labels not contained in a dict / Series will be left
as-is. Extra labels listed don't throw an error. Alternatively, change
``Series.name`` with a scalar value (Series only).
Parameters
-----... | pandas/core/generic.py | def rename(self, *args, **kwargs):
"""
Alter axes input function or functions. Function / dict values must be
unique (1-to-1). Labels not contained in a dict / Series will be left
as-is. Extra labels listed don't throw an error. Alternatively, change
``Series.name`` with a scalar... | def rename(self, *args, **kwargs):
"""
Alter axes input function or functions. Function / dict values must be
unique (1-to-1). Labels not contained in a dict / Series will be left
as-is. Extra labels listed don't throw an error. Alternatively, change
``Series.name`` with a scalar... | [
"Alter",
"axes",
"input",
"function",
"or",
"functions",
".",
"Function",
"/",
"dict",
"values",
"must",
"be",
"unique",
"(",
"1",
"-",
"to",
"-",
"1",
")",
".",
"Labels",
"not",
"contained",
"in",
"a",
"dict",
"/",
"Series",
"will",
"be",
"left",
"a... | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L970-L1129 | [
"def",
"rename",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"args",
",",
"kwargs",
")",
"copy",
"=",
"kwargs",
".",
"pop",
"(",
"'copy'",
",",
"Tru... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.rename_axis | Set the name of the axis for the index or columns.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function, optional
A scalar, list-like, dict-like or functions tra... | pandas/core/generic.py | def rename_axis(self, mapper=sentinel, **kwargs):
"""
Set the name of the axis for the index or columns.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function... | def rename_axis(self, mapper=sentinel, **kwargs):
"""
Set the name of the axis for the index or columns.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function... | [
"Set",
"the",
"name",
"of",
"the",
"axis",
"for",
"the",
"index",
"or",
"columns",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1133-L1312 | [
"def",
"rename_axis",
"(",
"self",
",",
"mapper",
"=",
"sentinel",
",",
"*",
"*",
"kwargs",
")",
":",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"(",
")",
",",
"kwargs",
",",
"sentinel",
"=",
"sentinel",
")",
"copy",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._set_axis_name | Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'index' specifies index,
and the value 1 or 'columns' specifies col... | pandas/core/generic.py | def _set_axis_name(self, name, axis=0, inplace=False):
"""
Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'ind... | def _set_axis_name(self, name, axis=0, inplace=False):
"""
Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'ind... | [
"Set",
"the",
"name",
"(",
"s",
")",
"of",
"the",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1314-L1373 | [
"def",
"_set_axis_name",
"(",
"self",
",",
"name",
",",
"axis",
"=",
"0",
",",
"inplace",
"=",
"False",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"idx",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
")",
".",
"set_names"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.equals | Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against
each other to see if they have the same shape and elements. NaNs in
the same location are considered equal. The column headers do not
need to have the same type, but ... | pandas/core/generic.py | def equals(self, other):
"""
Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against
each other to see if they have the same shape and elements. NaNs in
the same location are considered equal. The column headers do... | def equals(self, other):
"""
Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against
each other to see if they have the same shape and elements. NaNs in
the same location are considered equal. The column headers do... | [
"Test",
"whether",
"two",
"objects",
"contain",
"the",
"same",
"elements",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1382-L1466 | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"_constructor",
")",
":",
"return",
"False",
"return",
"self",
".",
"_data",
".",
"equals",
"(",
"other",
".",
"_data",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.bool | Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean | pandas/core/generic.py | def bool(self):
"""
Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean
"""
v = self.squeeze()
... | def bool(self):
"""
Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean
"""
v = self.squeeze()
... | [
"Return",
"the",
"bool",
"of",
"a",
"single",
"element",
"PandasObject",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1514-L1529 | [
"def",
"bool",
"(",
"self",
")",
":",
"v",
"=",
"self",
".",
"squeeze",
"(",
")",
"if",
"isinstance",
"(",
"v",
",",
"(",
"bool",
",",
"np",
".",
"bool_",
")",
")",
":",
"return",
"bool",
"(",
"v",
")",
"elif",
"is_scalar",
"(",
"v",
")",
":"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._is_level_reference | Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1): Matches the name of a column level and does NOT match
... | pandas/core/generic.py | def _is_level_reference(self, key, axis=0):
"""
Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1)... | def _is_level_reference(self, key, axis=0):
"""
Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1)... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1545-L1576 | [
"def",
"_is_level_reference",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_level_reference is... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._is_label_reference | Test whether a key is a label reference for a given axis.
To be considered a label reference, `key` must be a string that:
- (axis=0): Matches a column label
- (axis=1): Matches an index label
Parameters
----------
key: str
Potential label name
a... | pandas/core/generic.py | def _is_label_reference(self, key, axis=0):
"""
Test whether a key is a label reference for a given axis.
To be considered a label reference, `key` must be a string that:
- (axis=0): Matches a column label
- (axis=1): Matches an index label
Parameters
------... | def _is_label_reference(self, key, axis=0):
"""
Test whether a key is a label reference for a given axis.
To be considered a label reference, `key` must be a string that:
- (axis=0): Matches a column label
- (axis=1): Matches an index label
Parameters
------... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"reference",
"for",
"a",
"given",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1578-L1608 | [
"def",
"_is_label_reference",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_label_reference is not implemented for {type}\"",
".",
"format",
"(",
"type",
"=",
"ty... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._is_label_or_level_reference | Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis=1): Matches an index label or a column level
Parameters
... | pandas/core/generic.py | def _is_label_or_level_reference(self, key, axis=0):
"""
Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis... | def _is_label_or_level_reference(self, key, axis=0):
"""
Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"or",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1610-L1637 | [
"def",
"_is_label_or_level_reference",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_label_or_level_reference is not implemented for {type}\"",
".",
"format",
"(",
"t... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._check_label_or_level_ambiguity | Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key: str or object
label or level name
axis: int, default 0
Axis that levels are associa... | pandas/core/generic.py | def _check_label_or_level_ambiguity(self, key, axis=0):
"""
Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key: str or object
label or leve... | def _check_label_or_level_ambiguity(self, key, axis=0):
"""
Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key: str or object
label or leve... | [
"Check",
"whether",
"key",
"is",
"ambiguous",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1639-L1686 | [
"def",
"_check_label_or_level_ambiguity",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_check_label_or_level_ambiguity is not implemented for {type}\"",
".",
"format",
"("... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._get_label_or_level_values | Return a 1-D array of values associated with `key`, a label or level
from the given `axis`.
Retrieval logic:
- (axis=0): Return column values if `key` matches a column label.
Otherwise return index level values if `key` matches an index
level.
- (axis=1): Ret... | pandas/core/generic.py | def _get_label_or_level_values(self, key, axis=0):
"""
Return a 1-D array of values associated with `key`, a label or level
from the given `axis`.
Retrieval logic:
- (axis=0): Return column values if `key` matches a column label.
Otherwise return index level values... | def _get_label_or_level_values(self, key, axis=0):
"""
Return a 1-D array of values associated with `key`, a label or level
from the given `axis`.
Retrieval logic:
- (axis=0): Return column values if `key` matches a column label.
Otherwise return index level values... | [
"Return",
"a",
"1",
"-",
"D",
"array",
"of",
"values",
"associated",
"with",
"key",
"a",
"label",
"or",
"level",
"from",
"the",
"given",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1688-L1757 | [
"def",
"_get_label_or_level_values",
"(",
"self",
",",
"key",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_get_label_or_level_values is not implemented for {type}\"",
".",
"format",
"(",
"type"... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._drop_labels_or_levels | Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If key matches an index label then drop the row.
Otherwise... | pandas/core/generic.py | def _drop_labels_or_levels(self, keys, axis=0):
"""
Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If... | def _drop_labels_or_levels(self, keys, axis=0):
"""
Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If... | [
"Drop",
"labels",
"and",
"/",
"or",
"levels",
"for",
"the",
"given",
"axis",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1759-L1838 | [
"def",
"_drop_labels_or_levels",
"(",
"self",
",",
"keys",
",",
"axis",
"=",
"0",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_drop_labels_or_levels is not implemented for {type}\"",
".",
"format",
"(",
"type",
"="... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.empty | Indicator whether DataFrame is empty.
True if DataFrame is entirely empty (no items), meaning any of the
axes are of length 0.
Returns
-------
bool
If DataFrame is empty, return True, if not return False.
See Also
--------
Series.dropna
... | pandas/core/generic.py | def empty(self):
"""
Indicator whether DataFrame is empty.
True if DataFrame is entirely empty (no items), meaning any of the
axes are of length 0.
Returns
-------
bool
If DataFrame is empty, return True, if not return False.
See Also
... | def empty(self):
"""
Indicator whether DataFrame is empty.
True if DataFrame is entirely empty (no items), meaning any of the
axes are of length 0.
Returns
-------
bool
If DataFrame is empty, return True, if not return False.
See Also
... | [
"Indicator",
"whether",
"DataFrame",
"is",
"empty",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1878-L1924 | [
"def",
"empty",
"(",
"self",
")",
":",
"return",
"any",
"(",
"len",
"(",
"self",
".",
"_get_axis",
"(",
"a",
")",
")",
"==",
"0",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._repr_data_resource_ | Not a real Jupyter special repr method, but we use the same
naming convention. | pandas/core/generic.py | def _repr_data_resource_(self):
"""
Not a real Jupyter special repr method, but we use the same
naming convention.
"""
if config.get_option("display.html.table_schema"):
data = self.head(config.get_option('display.max_rows'))
payload = json.loads(data.to_j... | def _repr_data_resource_(self):
"""
Not a real Jupyter special repr method, but we use the same
naming convention.
"""
if config.get_option("display.html.table_schema"):
data = self.head(config.get_option('display.max_rows'))
payload = json.loads(data.to_j... | [
"Not",
"a",
"real",
"Jupyter",
"special",
"repr",
"method",
"but",
"we",
"use",
"the",
"same",
"naming",
"convention",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2021-L2030 | [
"def",
"_repr_data_resource_",
"(",
"self",
")",
":",
"if",
"config",
".",
"get_option",
"(",
"\"display.html.table_schema\"",
")",
":",
"data",
"=",
"self",
".",
"head",
"(",
"config",
".",
"get_option",
"(",
"'display.max_rows'",
")",
")",
"payload",
"=",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_json | Convert the object to a JSON string.
Note NaN's and None will be converted to null and datetime objects
will be converted to UNIX timestamps.
Parameters
----------
path_or_buf : string or file handle, optional
File path or object. If not specified, the result is ret... | pandas/core/generic.py | def to_json(self, path_or_buf=None, orient=None, date_format=None,
double_precision=10, force_ascii=True, date_unit='ms',
default_handler=None, lines=False, compression='infer',
index=True):
"""
Convert the object to a JSON string.
Note NaN's and ... | def to_json(self, path_or_buf=None, orient=None, date_format=None,
double_precision=10, force_ascii=True, date_unit='ms',
default_handler=None, lines=False, compression='infer',
index=True):
"""
Convert the object to a JSON string.
Note NaN's and ... | [
"Convert",
"the",
"object",
"to",
"a",
"JSON",
"string",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2158-L2302 | [
"def",
"to_json",
"(",
"self",
",",
"path_or_buf",
"=",
"None",
",",
"orient",
"=",
"None",
",",
"date_format",
"=",
"None",
",",
"double_precision",
"=",
"10",
",",
"force_ascii",
"=",
"True",
",",
"date_unit",
"=",
"'ms'",
",",
"default_handler",
"=",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_hdf | Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an
application to interpret the structure and contents of a file with
no outside information. One HDF file can hold a mix of related objects
which can be accessed as a gr... | pandas/core/generic.py | def to_hdf(self, path_or_buf, key, **kwargs):
"""
Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an
application to interpret the structure and contents of a file with
no outside information. One HDF file can h... | def to_hdf(self, path_or_buf, key, **kwargs):
"""
Write the contained data to an HDF5 file using HDFStore.
Hierarchical Data Format (HDF) is self-describing, allowing an
application to interpret the structure and contents of a file with
no outside information. One HDF file can h... | [
"Write",
"the",
"contained",
"data",
"to",
"an",
"HDF5",
"file",
"using",
"HDFStore",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2304-L2406 | [
"def",
"to_hdf",
"(",
"self",
",",
"path_or_buf",
",",
"key",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"pytables",
"return",
"pytables",
".",
"to_hdf",
"(",
"path_or_buf",
",",
"key",
",",
"self",
",",
"*",
"*",
"kwar... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_msgpack | Serialize object to input file path using msgpack format.
THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Parameters
----------
path : string File path, buffer-like, or None
if None, return generated string
ap... | pandas/core/generic.py | def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs):
"""
Serialize object to input file path using msgpack format.
THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Parameters
----------
path : string... | def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs):
"""
Serialize object to input file path using msgpack format.
THIS IS AN EXPERIMENTAL LIBRARY and the storage format
may not be stable until a future release.
Parameters
----------
path : string... | [
"Serialize",
"object",
"to",
"input",
"file",
"path",
"using",
"msgpack",
"format",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2408-L2427 | [
"def",
"to_msgpack",
"(",
"self",
",",
"path_or_buf",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"packers",
"return",
"packers",
".",
"to_msgpack",
"(",
"path_or_buf",
",",
"sel... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_sql | Write records stored in a DataFrame to a SQL database.
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created, appended to, or overwritten.
Parameters
----------
name : string
Name of SQL table.
con : sqlalchemy.engine.Engine or sq... | pandas/core/generic.py | def to_sql(self, name, con, schema=None, if_exists='fail', index=True,
index_label=None, chunksize=None, dtype=None, method=None):
"""
Write records stored in a DataFrame to a SQL database.
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created,... | def to_sql(self, name, con, schema=None, if_exists='fail', index=True,
index_label=None, chunksize=None, dtype=None, method=None):
"""
Write records stored in a DataFrame to a SQL database.
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created,... | [
"Write",
"records",
"stored",
"in",
"a",
"DataFrame",
"to",
"a",
"SQL",
"database",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2429-L2560 | [
"def",
"to_sql",
"(",
"self",
",",
"name",
",",
"con",
",",
"schema",
"=",
"None",
",",
"if_exists",
"=",
"'fail'",
",",
"index",
"=",
"True",
",",
"index_label",
"=",
"None",
",",
"chunksize",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"method",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_pickle | Pickle (serialize) object to file.
Parameters
----------
path : str
File path where the pickled object will be stored.
compression : {'infer', 'gzip', 'bz2', 'zip', 'xz', None}, \
default 'infer'
A string representing the compression to use in the output ... | pandas/core/generic.py | def to_pickle(self, path, compression='infer',
protocol=pickle.HIGHEST_PROTOCOL):
"""
Pickle (serialize) object to file.
Parameters
----------
path : str
File path where the pickled object will be stored.
compression : {'infer', 'gzip', 'bz2... | def to_pickle(self, path, compression='infer',
protocol=pickle.HIGHEST_PROTOCOL):
"""
Pickle (serialize) object to file.
Parameters
----------
path : str
File path where the pickled object will be stored.
compression : {'infer', 'gzip', 'bz2... | [
"Pickle",
"(",
"serialize",
")",
"object",
"to",
"file",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2562-L2619 | [
"def",
"to_pickle",
"(",
"self",
",",
"path",
",",
"compression",
"=",
"'infer'",
",",
"protocol",
"=",
"pickle",
".",
"HIGHEST_PROTOCOL",
")",
":",
"from",
"pandas",
".",
"io",
".",
"pickle",
"import",
"to_pickle",
"return",
"to_pickle",
"(",
"self",
",",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_clipboard | r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
- True, use the provided separator, writing in a csv format ... | pandas/core/generic.py | def to_clipboard(self, excel=True, sep=None, **kwargs):
r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
... | def to_clipboard(self, excel=True, sep=None, **kwargs):
r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
... | [
"r",
"Copy",
"object",
"to",
"the",
"system",
"clipboard",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2621-L2676 | [
"def",
"to_clipboard",
"(",
"self",
",",
"excel",
"=",
"True",
",",
"sep",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"clipboards",
"clipboards",
".",
"to_clipboard",
"(",
"self",
",",
"excel",
"=",
"excel",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_xarray | Return an xarray object from the pandas object.
Returns
-------
xarray.DataArray or xarray.Dataset
Data in the pandas structure converted to Dataset if the object is
a DataFrame, or a DataArray if the object is a Series.
See Also
--------
DataFra... | pandas/core/generic.py | def to_xarray(self):
"""
Return an xarray object from the pandas object.
Returns
-------
xarray.DataArray or xarray.Dataset
Data in the pandas structure converted to Dataset if the object is
a DataFrame, or a DataArray if the object is a Series.
... | def to_xarray(self):
"""
Return an xarray object from the pandas object.
Returns
-------
xarray.DataArray or xarray.Dataset
Data in the pandas structure converted to Dataset if the object is
a DataFrame, or a DataArray if the object is a Series.
... | [
"Return",
"an",
"xarray",
"object",
"from",
"the",
"pandas",
"object",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2678-L2773 | [
"def",
"to_xarray",
"(",
"self",
")",
":",
"try",
":",
"import",
"xarray",
"except",
"ImportError",
":",
"# Give a nice error message",
"raise",
"ImportError",
"(",
"\"the xarray library is not installed\\n\"",
"\"you can install via conda\\n\"",
"\"conda install xarray\\n\"",
... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_latex | r"""
Render an object to a LaTeX tabular environment table.
Render an object to a tabular environment table. You can splice
this into a LaTeX document. Requires \usepackage{booktabs}.
.. versionchanged:: 0.20.2
Added to Series
Parameters
----------
b... | pandas/core/generic.py | def to_latex(self, buf=None, columns=None, col_space=None, header=True,
index=True, na_rep='NaN', formatters=None, float_format=None,
sparsify=None, index_names=True, bold_rows=False,
column_format=None, longtable=None, escape=None,
encoding=None, deci... | def to_latex(self, buf=None, columns=None, col_space=None, header=True,
index=True, na_rep='NaN', formatters=None, float_format=None,
sparsify=None, index_names=True, bold_rows=False,
column_format=None, longtable=None, escape=None,
encoding=None, deci... | [
"r",
"Render",
"an",
"object",
"to",
"a",
"LaTeX",
"tabular",
"environment",
"table",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2775-L2910 | [
"def",
"to_latex",
"(",
"self",
",",
"buf",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"col_space",
"=",
"None",
",",
"header",
"=",
"True",
",",
"index",
"=",
"True",
",",
"na_rep",
"=",
"'NaN'",
",",
"formatters",
"=",
"None",
",",
"float_forma... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame.to_csv | r"""
Write object to a comma-separated values (csv) file.
.. versionchanged:: 0.24.0
The order of arguments for Series was changed.
Parameters
----------
path_or_buf : str or file handle, default None
File path or object, if None is provided the result i... | pandas/core/generic.py | def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
columns=None, header=True, index=True, index_label=None,
mode='w', encoding=None, compression='infer', quoting=None,
quotechar='"', line_terminator=None, chunksize=None,
tupleize_cols=No... | def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
columns=None, header=True, index=True, index_label=None,
mode='w', encoding=None, compression='infer', quoting=None,
quotechar='"', line_terminator=None, chunksize=None,
tupleize_cols=No... | [
"r",
"Write",
"object",
"to",
"a",
"comma",
"-",
"separated",
"values",
"(",
"csv",
")",
"file",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2912-L3053 | [
"def",
"to_csv",
"(",
"self",
",",
"path_or_buf",
"=",
"None",
",",
"sep",
"=",
"\",\"",
",",
"na_rep",
"=",
"''",
",",
"float_format",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"header",
"=",
"True",
",",
"index",
"=",
"True",
",",
"index_label... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
train | NDFrame._create_indexer | Create an indexer like _name in the class. | pandas/core/generic.py | def _create_indexer(cls, name, indexer):
"""Create an indexer like _name in the class."""
if getattr(cls, name, None) is None:
_indexer = functools.partial(indexer, name)
setattr(cls, name, property(_indexer, doc=indexer.__doc__)) | def _create_indexer(cls, name, indexer):
"""Create an indexer like _name in the class."""
if getattr(cls, name, None) is None:
_indexer = functools.partial(indexer, name)
setattr(cls, name, property(_indexer, doc=indexer.__doc__)) | [
"Create",
"an",
"indexer",
"like",
"_name",
"in",
"the",
"class",
"."
] | pandas-dev/pandas | python | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3059-L3063 | [
"def",
"_create_indexer",
"(",
"cls",
",",
"name",
",",
"indexer",
")",
":",
"if",
"getattr",
"(",
"cls",
",",
"name",
",",
"None",
")",
"is",
"None",
":",
"_indexer",
"=",
"functools",
".",
"partial",
"(",
"indexer",
",",
"name",
")",
"setattr",
"("... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.