id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
20,100 | pandas-dev/pandas | pandas/io/pytables.py | IndexCol.write_metadata | def write_metadata(self, handler):
""" set the meta data """
if self.metadata is not None:
handler.write_metadata(self.cname, self.metadata) | python | def write_metadata(self, handler):
""" set the meta data """
if self.metadata is not None:
handler.write_metadata(self.cname, self.metadata) | [
"def",
"write_metadata",
"(",
"self",
",",
"handler",
")",
":",
"if",
"self",
".",
"metadata",
"is",
"not",
"None",
":",
"handler",
".",
"write_metadata",
"(",
"self",
".",
"cname",
",",
"self",
".",
"metadata",
")"
] | set the meta data | [
"set",
"the",
"meta",
"data"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1794-L1797 |
20,101 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.create_for_block | def create_for_block(
cls, i=None, name=None, cname=None, version=None, **kwargs):
""" return a new datacol with the block i """
if cname is None:
cname = name or 'values_block_{idx}'.format(idx=i)
if name is None:
name = cname
# prior to 0.10.1, we ... | python | def create_for_block(
cls, i=None, name=None, cname=None, version=None, **kwargs):
""" return a new datacol with the block i """
if cname is None:
cname = name or 'values_block_{idx}'.format(idx=i)
if name is None:
name = cname
# prior to 0.10.1, we ... | [
"def",
"create_for_block",
"(",
"cls",
",",
"i",
"=",
"None",
",",
"name",
"=",
"None",
",",
"cname",
"=",
"None",
",",
"version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"cname",
"is",
"None",
":",
"cname",
"=",
"name",
"or",
"'val... | return a new datacol with the block i | [
"return",
"a",
"new",
"datacol",
"with",
"the",
"block",
"i"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1839-L1858 |
20,102 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.set_metadata | def set_metadata(self, metadata):
""" record the metadata """
if metadata is not None:
metadata = np.array(metadata, copy=False).ravel()
self.metadata = metadata | python | def set_metadata(self, metadata):
""" record the metadata """
if metadata is not None:
metadata = np.array(metadata, copy=False).ravel()
self.metadata = metadata | [
"def",
"set_metadata",
"(",
"self",
",",
"metadata",
")",
":",
"if",
"metadata",
"is",
"not",
"None",
":",
"metadata",
"=",
"np",
".",
"array",
"(",
"metadata",
",",
"copy",
"=",
"False",
")",
".",
"ravel",
"(",
")",
"self",
".",
"metadata",
"=",
"... | record the metadata | [
"record",
"the",
"metadata"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1904-L1908 |
20,103 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.set_atom | def set_atom(self, block, block_items, existing_col, min_itemsize,
nan_rep, info, encoding=None, errors='strict'):
""" create and setup my atom from the block b """
self.values = list(block_items)
# short-cut certain block types
if block.is_categorical:
ret... | python | def set_atom(self, block, block_items, existing_col, min_itemsize,
nan_rep, info, encoding=None, errors='strict'):
""" create and setup my atom from the block b """
self.values = list(block_items)
# short-cut certain block types
if block.is_categorical:
ret... | [
"def",
"set_atom",
"(",
"self",
",",
"block",
",",
"block_items",
",",
"existing_col",
",",
"min_itemsize",
",",
"nan_rep",
",",
"info",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"self",
".",
"values",
"=",
"list",
"(",
"b... | create and setup my atom from the block b | [
"create",
"and",
"setup",
"my",
"atom",
"from",
"the",
"block",
"b"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1939-L1990 |
20,104 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.get_atom_coltype | def get_atom_coltype(self, kind=None):
""" return the PyTables column class for this column """
if kind is None:
kind = self.kind
if self.kind.startswith('uint'):
col_name = "UInt{name}Col".format(name=kind[4:])
else:
col_name = "{name}Col".format(name... | python | def get_atom_coltype(self, kind=None):
""" return the PyTables column class for this column """
if kind is None:
kind = self.kind
if self.kind.startswith('uint'):
col_name = "UInt{name}Col".format(name=kind[4:])
else:
col_name = "{name}Col".format(name... | [
"def",
"get_atom_coltype",
"(",
"self",
",",
"kind",
"=",
"None",
")",
":",
"if",
"kind",
"is",
"None",
":",
"kind",
"=",
"self",
".",
"kind",
"if",
"self",
".",
"kind",
".",
"startswith",
"(",
"'uint'",
")",
":",
"col_name",
"=",
"\"UInt{name}Col\"",
... | return the PyTables column class for this column | [
"return",
"the",
"PyTables",
"column",
"class",
"for",
"this",
"column"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2043-L2052 |
20,105 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.validate_attr | def validate_attr(self, append):
"""validate that we have the same order as the existing & same dtype"""
if append:
existing_fields = getattr(self.attrs, self.kind_attr, None)
if (existing_fields is not None and
existing_fields != list(self.values)):
... | python | def validate_attr(self, append):
"""validate that we have the same order as the existing & same dtype"""
if append:
existing_fields = getattr(self.attrs, self.kind_attr, None)
if (existing_fields is not None and
existing_fields != list(self.values)):
... | [
"def",
"validate_attr",
"(",
"self",
",",
"append",
")",
":",
"if",
"append",
":",
"existing_fields",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"kind_attr",
",",
"None",
")",
"if",
"(",
"existing_fields",
"is",
"not",
"None",
"and",
... | validate that we have the same order as the existing & same dtype | [
"validate",
"that",
"we",
"have",
"the",
"same",
"order",
"as",
"the",
"existing",
"&",
"same",
"dtype"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2139-L2152 |
20,106 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.get_attr | def get_attr(self):
""" get the data for this column """
self.values = getattr(self.attrs, self.kind_attr, None)
self.dtype = getattr(self.attrs, self.dtype_attr, None)
self.meta = getattr(self.attrs, self.meta_attr, None)
self.set_kind() | python | def get_attr(self):
""" get the data for this column """
self.values = getattr(self.attrs, self.kind_attr, None)
self.dtype = getattr(self.attrs, self.dtype_attr, None)
self.meta = getattr(self.attrs, self.meta_attr, None)
self.set_kind() | [
"def",
"get_attr",
"(",
"self",
")",
":",
"self",
".",
"values",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"kind_attr",
",",
"None",
")",
"self",
".",
"dtype",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"dtype_a... | get the data for this column | [
"get",
"the",
"data",
"for",
"this",
"column"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2232-L2237 |
20,107 | pandas-dev/pandas | pandas/io/pytables.py | DataCol.set_attr | def set_attr(self):
""" set the data for this column """
setattr(self.attrs, self.kind_attr, self.values)
setattr(self.attrs, self.meta_attr, self.meta)
if self.dtype is not None:
setattr(self.attrs, self.dtype_attr, self.dtype) | python | def set_attr(self):
""" set the data for this column """
setattr(self.attrs, self.kind_attr, self.values)
setattr(self.attrs, self.meta_attr, self.meta)
if self.dtype is not None:
setattr(self.attrs, self.dtype_attr, self.dtype) | [
"def",
"set_attr",
"(",
"self",
")",
":",
"setattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"kind_attr",
",",
"self",
".",
"values",
")",
"setattr",
"(",
"self",
".",
"attrs",
",",
"self",
".",
"meta_attr",
",",
"self",
".",
"meta",
")",
"if"... | set the data for this column | [
"set",
"the",
"data",
"for",
"this",
"column"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2239-L2244 |
20,108 | pandas-dev/pandas | pandas/io/pytables.py | Fixed.set_version | def set_version(self):
""" compute and set our version """
version = _ensure_decoded(
getattr(self.group._v_attrs, 'pandas_version', None))
try:
self.version = tuple(int(x) for x in version.split('.'))
if len(self.version) == 2:
self.version = ... | python | def set_version(self):
""" compute and set our version """
version = _ensure_decoded(
getattr(self.group._v_attrs, 'pandas_version', None))
try:
self.version = tuple(int(x) for x in version.split('.'))
if len(self.version) == 2:
self.version = ... | [
"def",
"set_version",
"(",
"self",
")",
":",
"version",
"=",
"_ensure_decoded",
"(",
"getattr",
"(",
"self",
".",
"group",
".",
"_v_attrs",
",",
"'pandas_version'",
",",
"None",
")",
")",
"try",
":",
"self",
".",
"version",
"=",
"tuple",
"(",
"int",
"(... | compute and set our version | [
"compute",
"and",
"set",
"our",
"version"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2307-L2316 |
20,109 | pandas-dev/pandas | pandas/io/pytables.py | Fixed.set_object_info | def set_object_info(self):
""" set my pandas type & version """
self.attrs.pandas_type = str(self.pandas_kind)
self.attrs.pandas_version = str(_version)
self.set_version() | python | def set_object_info(self):
""" set my pandas type & version """
self.attrs.pandas_type = str(self.pandas_kind)
self.attrs.pandas_version = str(_version)
self.set_version() | [
"def",
"set_object_info",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"pandas_type",
"=",
"str",
"(",
"self",
".",
"pandas_kind",
")",
"self",
".",
"attrs",
".",
"pandas_version",
"=",
"str",
"(",
"_version",
")",
"self",
".",
"set_version",
"(",
... | set my pandas type & version | [
"set",
"my",
"pandas",
"type",
"&",
"version"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2339-L2343 |
20,110 | pandas-dev/pandas | pandas/io/pytables.py | Fixed.infer_axes | def infer_axes(self):
""" infer the axes of my storer
return a boolean indicating if we have a valid storer or not """
s = self.storable
if s is None:
return False
self.get_attrs()
return True | python | def infer_axes(self):
""" infer the axes of my storer
return a boolean indicating if we have a valid storer or not """
s = self.storable
if s is None:
return False
self.get_attrs()
return True | [
"def",
"infer_axes",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"storable",
"if",
"s",
"is",
"None",
":",
"return",
"False",
"self",
".",
"get_attrs",
"(",
")",
"return",
"True"
] | infer the axes of my storer
return a boolean indicating if we have a valid storer or not | [
"infer",
"the",
"axes",
"of",
"my",
"storer",
"return",
"a",
"boolean",
"indicating",
"if",
"we",
"have",
"a",
"valid",
"storer",
"or",
"not"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2416-L2424 |
20,111 | pandas-dev/pandas | pandas/io/pytables.py | GenericFixed.validate_read | def validate_read(self, kwargs):
"""
remove table keywords from kwargs and return
raise if any keywords are passed which are not-None
"""
kwargs = copy.copy(kwargs)
columns = kwargs.pop('columns', None)
if columns is not None:
raise TypeError("cannot ... | python | def validate_read(self, kwargs):
"""
remove table keywords from kwargs and return
raise if any keywords are passed which are not-None
"""
kwargs = copy.copy(kwargs)
columns = kwargs.pop('columns', None)
if columns is not None:
raise TypeError("cannot ... | [
"def",
"validate_read",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"copy",
".",
"copy",
"(",
"kwargs",
")",
"columns",
"=",
"kwargs",
".",
"pop",
"(",
"'columns'",
",",
"None",
")",
"if",
"columns",
"is",
"not",
"None",
":",
"raise",
"TypeE... | remove table keywords from kwargs and return
raise if any keywords are passed which are not-None | [
"remove",
"table",
"keywords",
"from",
"kwargs",
"and",
"return",
"raise",
"if",
"any",
"keywords",
"are",
"passed",
"which",
"are",
"not",
"-",
"None"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2480-L2497 |
20,112 | pandas-dev/pandas | pandas/io/pytables.py | GenericFixed.set_attrs | def set_attrs(self):
""" set our object attributes """
self.attrs.encoding = self.encoding
self.attrs.errors = self.errors | python | def set_attrs(self):
""" set our object attributes """
self.attrs.encoding = self.encoding
self.attrs.errors = self.errors | [
"def",
"set_attrs",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"encoding",
"=",
"self",
".",
"encoding",
"self",
".",
"attrs",
".",
"errors",
"=",
"self",
".",
"errors"
] | set our object attributes | [
"set",
"our",
"object",
"attributes"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2503-L2506 |
20,113 | pandas-dev/pandas | pandas/io/pytables.py | GenericFixed.read_array | def read_array(self, key, start=None, stop=None):
""" read an array for the specified node (off of group """
import tables
node = getattr(self.group, key)
attrs = node._v_attrs
transposed = getattr(attrs, 'transposed', False)
if isinstance(node, tables.VLArray):
... | python | def read_array(self, key, start=None, stop=None):
""" read an array for the specified node (off of group """
import tables
node = getattr(self.group, key)
attrs = node._v_attrs
transposed = getattr(attrs, 'transposed', False)
if isinstance(node, tables.VLArray):
... | [
"def",
"read_array",
"(",
"self",
",",
"key",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"import",
"tables",
"node",
"=",
"getattr",
"(",
"self",
".",
"group",
",",
"key",
")",
"attrs",
"=",
"node",
".",
"_v_attrs",
"transposed",
... | read an array for the specified node (off of group | [
"read",
"an",
"array",
"for",
"the",
"specified",
"node",
"(",
"off",
"of",
"group"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2518-L2549 |
20,114 | pandas-dev/pandas | pandas/io/pytables.py | GenericFixed.write_array_empty | def write_array_empty(self, key, value):
""" write a 0-len array """
# ugly hack for length 0 axes
arr = np.empty((1,) * value.ndim)
self._handle.create_array(self.group, key, arr)
getattr(self.group, key)._v_attrs.value_type = str(value.dtype)
getattr(self.group, key)._... | python | def write_array_empty(self, key, value):
""" write a 0-len array """
# ugly hack for length 0 axes
arr = np.empty((1,) * value.ndim)
self._handle.create_array(self.group, key, arr)
getattr(self.group, key)._v_attrs.value_type = str(value.dtype)
getattr(self.group, key)._... | [
"def",
"write_array_empty",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"# ugly hack for length 0 axes",
"arr",
"=",
"np",
".",
"empty",
"(",
"(",
"1",
",",
")",
"*",
"value",
".",
"ndim",
")",
"self",
".",
"_handle",
".",
"create_array",
"(",
"se... | write a 0-len array | [
"write",
"a",
"0",
"-",
"len",
"array"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2702-L2709 |
20,115 | pandas-dev/pandas | pandas/io/pytables.py | SparseFixed.validate_read | def validate_read(self, kwargs):
"""
we don't support start, stop kwds in Sparse
"""
kwargs = super().validate_read(kwargs)
if 'start' in kwargs or 'stop' in kwargs:
raise NotImplementedError("start and/or stop are not supported "
... | python | def validate_read(self, kwargs):
"""
we don't support start, stop kwds in Sparse
"""
kwargs = super().validate_read(kwargs)
if 'start' in kwargs or 'stop' in kwargs:
raise NotImplementedError("start and/or stop are not supported "
... | [
"def",
"validate_read",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
")",
".",
"validate_read",
"(",
"kwargs",
")",
"if",
"'start'",
"in",
"kwargs",
"or",
"'stop'",
"in",
"kwargs",
":",
"raise",
"NotImplementedError",
"(",
"\"start an... | we don't support start, stop kwds in Sparse | [
"we",
"don",
"t",
"support",
"start",
"stop",
"kwds",
"in",
"Sparse"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2859-L2867 |
20,116 | pandas-dev/pandas | pandas/io/pytables.py | SparseFrameFixed.write | def write(self, obj, **kwargs):
""" write it as a collection of individual sparse series """
super().write(obj, **kwargs)
for name, ss in obj.items():
key = 'sparse_series_{name}'.format(name=name)
if key not in self.group._v_children:
node = self._handle.... | python | def write(self, obj, **kwargs):
""" write it as a collection of individual sparse series """
super().write(obj, **kwargs)
for name, ss in obj.items():
key = 'sparse_series_{name}'.format(name=name)
if key not in self.group._v_children:
node = self._handle.... | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"write",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
"for",
"name",
",",
"ss",
"in",
"obj",
".",
"items",
"(",
")",
":",
"key",
"=",
"'sparse_se... | write it as a collection of individual sparse series | [
"write",
"it",
"as",
"a",
"collection",
"of",
"individual",
"sparse",
"series"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2911-L2924 |
20,117 | pandas-dev/pandas | pandas/io/pytables.py | Table.validate | def validate(self, other):
""" validate against an existing table """
if other is None:
return
if other.table_type != self.table_type:
raise TypeError(
"incompatible table_type with existing "
"[{other} - {self}]".format(
... | python | def validate(self, other):
""" validate against an existing table """
if other is None:
return
if other.table_type != self.table_type:
raise TypeError(
"incompatible table_type with existing "
"[{other} - {self}]".format(
... | [
"def",
"validate",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
"is",
"None",
":",
"return",
"if",
"other",
".",
"table_type",
"!=",
"self",
".",
"table_type",
":",
"raise",
"TypeError",
"(",
"\"incompatible table_type with existing \"",
"\"[{other} - {se... | validate against an existing table | [
"validate",
"against",
"an",
"existing",
"table"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3095-L3123 |
20,118 | pandas-dev/pandas | pandas/io/pytables.py | Table.validate_multiindex | 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... | python | 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",
")",
":",
"levels",
"=",
"[",
"l",
"if",
"l",
"is",
"not",
"None",
"else",
"\"level_{0}\"",
".",
"format",
"(",
"i",
")",
"for",
"i",
",",
"l",
"in",
"enumerate",
"(",
"obj",
".",
"index",
".",... | validate that we can store the multi-index; reset and return the
new object | [
"validate",
"that",
"we",
"can",
"store",
"the",
"multi",
"-",
"index",
";",
"reset",
"and",
"return",
"the",
"new",
"object"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3135-L3145 |
20,119 | pandas-dev/pandas | pandas/io/pytables.py | Table.nrows_expected | 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]) | python | 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",
")",
":",
"return",
"np",
".",
"prod",
"(",
"[",
"i",
".",
"cvalues",
".",
"shape",
"[",
"0",
"]",
"for",
"i",
"in",
"self",
".",
"index_axes",
"]",
")"
] | based on our axes, compute the expected nrows | [
"based",
"on",
"our",
"axes",
"compute",
"the",
"expected",
"nrows"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3148-L3150 |
20,120 | pandas-dev/pandas | pandas/io/pytables.py | Table.data_orientation | 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])) | python | 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",
"tuple",
"(",
"itertools",
".",
"chain",
"(",
"[",
"int",
"(",
"a",
"[",
"0",
"]",
")",
"for",
"a",
"in",
"self",
".",
"non_index_axes",
"]",
",",
"[",
"int",
"(",
"a",
".",
"axis",
")",... | return a tuple of my permutated axes, non_indexable at the front | [
"return",
"a",
"tuple",
"of",
"my",
"permutated",
"axes",
"non_indexable",
"at",
"the",
"front"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3188-L3191 |
20,121 | pandas-dev/pandas | pandas/io/pytables.py | Table.queryables | 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... | python | 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",
")",
":",
"# compute the values_axes queryables",
"return",
"dict",
"(",
"[",
"(",
"a",
".",
"cname",
",",
"a",
")",
"for",
"a",
"in",
"self",
".",
"index_axes",
"]",
"+",
"[",
"(",
"self",
".",
"storage_obj_type",
".",
... | return a dict of the kinds allowable columns for this object | [
"return",
"a",
"dict",
"of",
"the",
"kinds",
"allowable",
"columns",
"for",
"this",
"object"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3193-L3203 |
20,122 | pandas-dev/pandas | pandas/io/pytables.py | Table._get_metadata_path | 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) | python | 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",
"\"{group}/meta/{key}/meta\"",
".",
"format",
"(",
"group",
"=",
"self",
".",
"group",
".",
"_v_pathname",
",",
"key",
"=",
"key",
")"
] | return the metadata pathname for this key | [
"return",
"the",
"metadata",
"pathname",
"for",
"this",
"key"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3213-L3216 |
20,123 | pandas-dev/pandas | pandas/io/pytables.py | Table.write_metadata | 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... | python | 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",
")",
":",
"values",
"=",
"Series",
"(",
"values",
")",
"self",
".",
"parent",
".",
"put",
"(",
"self",
".",
"_get_metadata_path",
"(",
"key",
")",
",",
"values",
",",
"format",
"=",
"'t... | write out a meta data array to the key as a fixed-format Series
Parameters
----------
key : string
values : ndarray | [
"write",
"out",
"a",
"meta",
"data",
"array",
"to",
"the",
"key",
"as",
"a",
"fixed",
"-",
"format",
"Series"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3218-L3231 |
20,124 | pandas-dev/pandas | pandas/io/pytables.py | Table.read_metadata | 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 | python | 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",
")",
":",
"if",
"getattr",
"(",
"getattr",
"(",
"self",
".",
"group",
",",
"'meta'",
",",
"None",
")",
",",
"key",
",",
"None",
")",
"is",
"not",
"None",
":",
"return",
"self",
".",
"parent",
".",
... | return the meta data array for this key | [
"return",
"the",
"meta",
"data",
"array",
"for",
"this",
"key"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3233-L3237 |
20,125 | pandas-dev/pandas | pandas/io/pytables.py | Table.set_attrs | 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... | python | 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",
")",
":",
"self",
".",
"attrs",
".",
"table_type",
"=",
"str",
"(",
"self",
".",
"table_type",
")",
"self",
".",
"attrs",
".",
"index_cols",
"=",
"self",
".",
"index_cols",
"(",
")",
"self",
".",
"attrs",
".",
"values... | set our table type & indexables | [
"set",
"our",
"table",
"type",
"&",
"indexables"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3243-L3255 |
20,126 | pandas-dev/pandas | pandas/io/pytables.py | Table.validate_version | 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) ... | python | 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",
")",
":",
"if",
"where",
"is",
"not",
"None",
":",
"if",
"(",
"self",
".",
"version",
"[",
"0",
"]",
"<=",
"0",
"and",
"self",
".",
"version",
"[",
"1",
"]",
"<=",
"10",
"and",
... | are we trying to operate on an old version? | [
"are",
"we",
"trying",
"to",
"operate",
"on",
"an",
"old",
"version?"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3280-L3287 |
20,127 | pandas-dev/pandas | pandas/io/pytables.py | Table.validate_min_itemsize | 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 = ... | python | 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",
")",
":",
"if",
"min_itemsize",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"min_itemsize",
",",
"dict",
")",
":",
"return",
"q",
"=",
"self",
".",
"queryables",
"(",
")",
... | validate the min_itemisze doesn't contain items that are not in the
axes this needs data_columns to be defined | [
"validate",
"the",
"min_itemisze",
"doesn",
"t",
"contain",
"items",
"that",
"are",
"not",
"in",
"the",
"axes",
"this",
"needs",
"data_columns",
"to",
"be",
"defined"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3289-L3307 |
20,128 | pandas-dev/pandas | pandas/io/pytables.py | Table.validate_data_columns | 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... | python | 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",
")",
":",
"if",
"not",
"len",
"(",
"self",
".",
"non_index_axes",
")",
":",
"return",
"[",
"]",
"axis",
",",
"axis_labels",
"=",
"self",
".",
"non_index_axes",
"[",
"0",... | take the input data_columns and min_itemize and create a data
columns spec | [
"take",
"the",
"input",
"data_columns",
"and",
"min_itemize",
"and",
"create",
"a",
"data",
"columns",
"spec"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3435-L3466 |
20,129 | pandas-dev/pandas | pandas/io/pytables.py | Table.process_axes | 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 ... | python | 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",
")",
":",
"# make a copy to avoid side effects",
"if",
"columns",
"is",
"not",
"None",
":",
"columns",
"=",
"list",
"(",
"columns",
")",
"# make sure to include levels if we have them",
"... | process axes filters | [
"process",
"axes",
"filters"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3683-L3741 |
20,130 | pandas-dev/pandas | pandas/io/pytables.py | Table.create_description | 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... | python | 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",
")",
":",
"# provided expected rows if its passed",
"if",
"expectedrows",
"is",
"None",
":",
... | create the description of the table from the axes & values | [
"create",
"the",
"description",
"of",
"the",
"table",
"from",
"the",
"axes",
"&",
"values"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3743-L3766 |
20,131 | pandas-dev/pandas | pandas/io/pytables.py | Table.read_column | 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... | python | 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",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
")",
"# infer the data kind",
"if",
"not",
"self",
"... | return a single column from the table, generally only indexables
are interesting | [
"return",
"a",
"single",
"column",
"from",
"the",
"table",
"generally",
"only",
"indexables",
"are",
"interesting"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3793-L3829 |
20,132 | pandas-dev/pandas | pandas/io/pytables.py | LegacyTable.read | 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") | python | 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",
")",
":",
"if",
"not",
"self",
".",
"read_axes",
"(",
"where",
"=",
"where",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"None",
"raise"... | we have n indexable columns, with an arbitrary number of data
axes | [
"we",
"have",
"n",
"indexable",
"columns",
"with",
"an",
"arbitrary",
"number",
"of",
"data",
"axes"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3872-L3880 |
20,133 | pandas-dev/pandas | pandas/io/pytables.py | AppendableTable.write_data | 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:
... | python | 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",
")",
":",
"names",
"=",
"self",
".",
"dtype",
".",
"names",
"nrows",
"=",
"self",
".",
"nrows_expected",
"# if dropna==True, then drop ALL nan rows",
"masks",
"=",
"[",
"]",
"if... | we form the data into a 2-d including indexes,values,mask
write chunk-by-chunk | [
"we",
"form",
"the",
"data",
"into",
"a",
"2",
"-",
"d",
"including",
"indexes",
"values",
"mask",
"write",
"chunk",
"-",
"by",
"-",
"chunk"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3930-L4003 |
20,134 | pandas-dev/pandas | pandas/io/pytables.py | GenericTable.indexables | 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(... | python | 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",
")",
":",
"if",
"self",
".",
"_indexables",
"is",
"None",
":",
"d",
"=",
"self",
".",
"description",
"# the index columns is just a simple index",
"self",
".",
"_indexables",
"=",
"[",
"GenericIndexCol",
"(",
"name",
"=",
"'in... | create the indexables from the table description | [
"create",
"the",
"indexables",
"from",
"the",
"table",
"description"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4267-L4282 |
20,135 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.astype | 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 ... | python | 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",
")",
":",
"return",
"np",
".",
"array",
"(",
"self",
",",
"dtype",
"=",
"dtype",
",",
"copy",
"=",
"copy",
")"
] | 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 ... | [
"Cast",
"to",
"a",
"NumPy",
"array",
"with",
"dtype",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L322-L340 |
20,136 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.argsort | 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... | python | 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",
")",
":",
"# Implementor note: You have two places to override the behavior of",
"# argsort.",
"# 1. _values_for_argsort : construct... | 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.
... | [
"Return",
"the",
"indices",
"that",
"would",
"sort",
"this",
"array",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L381-L413 |
20,137 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.shift | 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... | python | 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",
":",
"# Note: this implementation assumes that `self.dtype.na_value` can be",
"# stored in an instance of your ExtensionA... | 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... | [
"Shift",
"values",
"by",
"desired",
"number",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L479-L535 |
20,138 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.unique | 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) | python | 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",
")",
":",
"from",
"pandas",
"import",
"unique",
"uniques",
"=",
"unique",
"(",
"self",
".",
"astype",
"(",
"object",
")",
")",
"return",
"self",
".",
"_from_sequence",
"(",
"uniques",
",",
"dtype",
"=",
"self",
".",
"dtype... | Compute the ExtensionArray of unique values.
Returns
-------
uniques : ExtensionArray | [
"Compute",
"the",
"ExtensionArray",
"of",
"unique",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L537-L548 |
20,139 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray._values_for_factorize | 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... | python | 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",
"self",
".",
"astype",
"(",
"object",
")",
",",
"np",
".",
"nan"
] | 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 ... | [
"Return",
"an",
"array",
"and",
"missing",
"value",
"suitable",
"for",
"factorization",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L598-L620 |
20,140 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.factorize | 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... | python | 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",
"]",
":",
"# Impelmentor note: There are two ways to override the behavior of",
"# pandas.factorize",
"# 1. ... | 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... | [
"Encode",
"the",
"extension",
"array",
"as",
"an",
"enumerated",
"type",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L622-L672 |
20,141 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray._formatter | 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
----... | python | 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",
"]",
"]",
":",
"if",
"boxed",
":",
"return",
"str",
"return",
"repr"
] | 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
... | [
"Formatting",
"function",
"for",
"scalar",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L857-L885 |
20,142 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray._reduce | 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, ... | python | 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",
")",
":",
"raise",
"TypeError",
"(",
"\"cannot perform {name} with type {dtype}\"",
".",
"format",
"(",
"name",
"=",
"name",
",",
"dtype",
"=",
"self",
".",
... | 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
... | [
"Return",
"a",
"scalar",
"result",
"of",
"performing",
"the",
"reduction",
"operation",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L939-L964 |
20,143 | pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionScalarOpsMixin._create_method | 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
... | python | 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",
")",
":",
"def",
"_binop",
"(",
"self",
",",
"other",
")",
":",
"def",
"convert_values",
"(",
"param",
")",
":",
"if",
"isinstance",
"(",
"param",
",",
"ExtensionArray",... | 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... | [
"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",... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L1034-L1113 |
20,144 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | ea_passthrough | 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... | python | 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",
")",
":",
"def",
"method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"array_method",
"(",
"self",
".",
"_data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"method",
... | Make an alias for a method of the underlying ExtensionArray.
Parameters
----------
array_method : method on an Array class
Returns
-------
method | [
"Make",
"an",
"alias",
"for",
"a",
"method",
"of",
"the",
"underlying",
"ExtensionArray",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L34-L52 |
20,145 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._create_comparison_method | 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... | python | 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",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"ABCSeries",
")",
":",
"# the arrays defer to Series for comparison ops but the indexes",
"# don't, so... | Create a comparison method that dispatches to ``cls.values``. | [
"Create",
"a",
"comparison",
"method",
"that",
"dispatches",
"to",
"cls",
".",
"values",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L107-L122 |
20,146 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._join_i8_wrapper | 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,
... | python | 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",
")",
":",
"from",
"pandas",
".",
"core",
".",
"arrays",
".",
"datetimelike",
"import",
"DatetimeLikeArrayMixin",
"@",
"staticmethod",
"def",
"wrapper",
"(",
"left",
",",
... | Create the join wrapper methods. | [
"Create",
"the",
"join",
"wrapper",
"methods",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L171-L192 |
20,147 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.sort_values | 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, _... | python | 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",
")",
":",
"if",
"return_indexer",
":",
"_as",
"=",
"self",
".",
"argsort",
"(",
")",
"if",
"not",
"ascending",
":",
"_as",
"=",
"_as",
"[",
":",
":... | Return sorted copy of Index. | [
"Return",
"sorted",
"copy",
"of",
"Index",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L236-L261 |
20,148 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.min | 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)
... | python | 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",
")",
":",
"nv",
".",
"validate_min",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
... | 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. | [
"Return",
"the",
"minimum",
"value",
"of",
"the",
"Index",
"or",
"minimum",
"along",
"an",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L315-L347 |
20,149 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.argmin | 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... | python | 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",
")",
":",
"nv",
".",
"validate_argmin",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
... | 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 | [
"Returns",
"the",
"indices",
"of",
"the",
"minimum",
"values",
"along",
"an",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L349-L370 |
20,150 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.max | 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)
... | python | 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",
")",
":",
"nv",
".",
"validate_max",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
")",
... | 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. | [
"Return",
"the",
"maximum",
"value",
"of",
"the",
"Index",
"or",
"maximum",
"along",
"an",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L372-L404 |
20,151 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.argmax | 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... | python | 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",
")",
":",
"nv",
".",
"validate_argmax",
"(",
"args",
",",
"kwargs",
")",
"nv",
".",
"validate_minmax_axis",
"(",
"axis",
... | 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 | [
"Returns",
"the",
"indices",
"of",
"the",
"maximum",
"values",
"along",
"an",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L406-L427 |
20,152 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._convert_scalar_indexer | 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 ... | python | 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",
")",
":",
"assert",
"kind",
"in",
"[",
"'ix'",
",",
"'loc'",
",",
"'getitem'",
",",
"'iloc'",
",",
"None",
"]",
"# we don't allow integer/float indexing for loc",
"# we don't al... | 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 | [
"We",
"don",
"t",
"allow",
"integer",
"or",
"float",
"indexing",
"on",
"datetime",
"-",
"like",
"when",
"using",
"loc",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L454-L477 |
20,153 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.isin | 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)
"""
... | python | 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",
")",
":",
"if",
"not",
"isinstance",
"(",
"values",
",",
"type",
"(",
"self",
")",
")",
":",
"try",
":",
"values",
"=",
"type",
"(",
"self",
")",
"(",
"values",
")",
"except",
"ValueError",
":",
"return",
... | 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",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L511-L530 |
20,154 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._concat_same_dtype | 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}) !... | python | 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",
")",
":",
"attribs",
"=",
"self",
".",
"_get_attributes_dict",
"(",
")",
"attribs",
"[",
"'name'",
"]",
"=",
"name",
"# do not pass tz to set because tzlocal cannot be hashed",
"if",
"len",
"... | Concatenate to_concat which has the same class. | [
"Concatenate",
"to_concat",
"which",
"has",
"the",
"same",
"class",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L578-L597 |
20,155 | pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.shift | 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
... | python | 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",
")",
":",
"result",
"=",
"self",
".",
"_data",
".",
"_time_shift",
"(",
"periods",
",",
"freq",
"=",
"freq",
")",
"return",
"type",
"(",
"self",
")",
"(",
"result",
",",
"name",... | 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,
... | [
"Shift",
"index",
"by",
"desired",
"number",
"of",
"time",
"frequency",
"increments",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L613-L644 |
20,156 | pandas-dev/pandas | pandas/core/generic.py | _single_replace | 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}'
... | python | 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",
")",
":",
"if",
"self",
".",
"ndim",
"!=",
"1",
":",
"raise",
"TypeError",
"(",
"'cannot replace {0} with method {1} on a {2}'",
".",
"format",
"(",
"to_repl... | Replaces values in a Series using the fill method specified when no
replacement value is given in the replace method | [
"Replaces",
"values",
"in",
"a",
"Series",
"using",
"the",
"fill",
"method",
"specified",
"when",
"no",
"replacement",
"value",
"is",
"given",
"in",
"the",
"replace",
"method"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L69-L95 |
20,157 | pandas-dev/pandas | pandas/core/generic.py | _doc_parms | 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__
... | python | 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",
")",
":",
"axis_descr",
"=",
"\"{%s}\"",
"%",
"', '",
".",
"join",
"(",
"\"{0} ({1})\"",
".",
"format",
"(",
"a",
",",
"i",
")",
"for",
"i",
",",
"a",
"in",
"enumerate",
"(",
"cls",
".",
"_AXIS_ORDERS",
")",
")",
"n... | Return a tuple of the doc parms. | [
"Return",
"a",
"tuple",
"of",
"the",
"doc",
"parms",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L10299-L10306 |
20,158 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._init_mgr | 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),
... | python | 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",
")",
":",
"for",
"a",
",",
"axe",
"in",
"axes",
".",
"items",
"(",
")",
":",
"if",
"axe",
"is",
"not",
"None",
":",
"... | passed a manager and a axes dict | [
"passed",
"a",
"manager",
"and",
"a",
"axes",
"dict"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L141-L156 |
20,159 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._validate_dtype | 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"
... | python | 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",
")",
":",
"if",
"dtype",
"is",
"not",
"None",
":",
"dtype",
"=",
"pandas_dtype",
"(",
"dtype",
")",
"# a compound dtype",
"if",
"dtype",
".",
"kind",
"==",
"'V'",
":",
"raise",
"NotImplementedError",
"("... | validate the passed dtype | [
"validate",
"the",
"passed",
"dtype"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L175-L187 |
20,160 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._setup_axes | 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 ... | python | 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",
"=... | 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... | [
"Provide",
"axes",
"setup",
"for",
"the",
"major",
"PandasObjects",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L217-L272 |
20,161 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._construct_axes_dict_from | 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 | python | 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",
")",
":",
"d",
"=",
"{",
"a",
":",
"ax",
"for",
"a",
",",
"ax",
"in",
"zip",
"(",
"self",
".",
"_AXIS_ORDERS",
",",
"axes",
")",
"}",
"d",
".",
"update",
"(",
... | Return an axes dictionary for the passed axes. | [
"Return",
"an",
"axes",
"dictionary",
"for",
"the",
"passed",
"axes",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L281-L285 |
20,162 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._get_block_manager_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 | python | 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",
")",
":",
"axis",
"=",
"cls",
".",
"_get_axis_number",
"(",
"axis",
")",
"if",
"cls",
".",
"_AXIS_REVERSED",
":",
"m",
"=",
"cls",
".",
"_AXIS_LEN",
"-",
"1",
"return",
"m",
"-",
"axis",
"retur... | Map the axis to the block_manager axis. | [
"Map",
"the",
"axis",
"to",
"the",
"block_manager",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L379-L385 |
20,163 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._get_space_character_free_column_resolvers | 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... | python | 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",
")",
":",
"from",
"pandas",
".",
"core",
".",
"computation",
".",
"common",
"import",
"_remove_spaces_column_name",
"return",
"{",
"_remove_spaces_column_name",
"(",
"k",
")",
":",
"v",
"for",
"k",
... | 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`. | [
"Return",
"the",
"space",
"character",
"free",
"column",
"resolvers",
"of",
"a",
"dataframe",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L423-L433 |
20,164 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.shape | def shape(self):
"""
Return a tuple of axis dimensions
"""
return tuple(len(self._get_axis(a)) for a in self._AXIS_ORDERS) | python | 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",
"tuple",
"(",
"len",
"(",
"self",
".",
"_get_axis",
"(",
"a",
")",
")",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
")"
] | Return a tuple of axis dimensions | [
"Return",
"a",
"tuple",
"of",
"axis",
"dimensions"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L444-L448 |
20,165 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.swapaxes | 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:
... | python | 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",
")",
":",
"i",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis1",
")",
"j",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis2",
")",
"if",
"i",
"==",
"j",
":",
... | Interchange axes and swap values axes appropriately.
Returns
-------
y : same as input | [
"Interchange",
"axes",
"and",
"swap",
"values",
"axes",
"appropriately",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L694-L718 |
20,166 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.pop | 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... | python | 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",
")",
":",
"result",
"=",
"self",
"[",
"item",
"]",
"del",
"self",
"[",
"item",
"]",
"try",
":",
"result",
".",
"_reset_cacher",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"return",
"result"
] | 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),
... ... | [
"Return",
"item",
"and",
"drop",
"from",
"frame",
".",
"Raise",
"KeyError",
"if",
"not",
"found",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L779-L827 |
20,167 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.squeeze | 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... | python | 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",
")",
":",
"axis",
"=",
"(",
"self",
".",
"_AXIS_NAMES",
"if",
"axis",
"is",
"None",
"else",
"(",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
",",
")",
")",
"try",
":",
"return",
"self"... | 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
... | [
"Squeeze",
"1",
"dimensional",
"axis",
"objects",
"into",
"scalars",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L829-L941 |
20,168 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.swaplevel | def swaplevel(self, i=-2, j=-1, axis=0):
"""
Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
Returns
-------
swapped : ... | python | def swaplevel(self, i=-2, j=-1, axis=0):
"""
Swap levels i and j in a MultiIndex on a particular axis
Parameters
----------
i, j : int, 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",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"result",
"=",
"self",
".",
"copy",
"(",
")",
"labels",
"=",
"... | 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::... | [
"Swap",
"levels",
"i",
"and",
"j",
"in",
"a",
"MultiIndex",
"on",
"a",
"particular",
"axis"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L943-L965 |
20,169 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.rename_axis | 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... | python | 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",
")",
":",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"(",
")",
",",
"kwargs",
",",
"sentinel",
"=",
"sentinel",
")",
"copy",
... | 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... | [
"Set",
"the",
"name",
"of",
"the",
"axis",
"for",
"the",
"index",
"or",
"columns",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1133-L1312 |
20,170 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.equals | 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... | python | 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",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"_constructor",
")",
":",
"return",
"False",
"return",
"self",
".",
"_data",
".",
"equals",
"(",
"other",
".",
"_data",
")"
] | 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 ... | [
"Test",
"whether",
"two",
"objects",
"contain",
"the",
"same",
"elements",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1382-L1466 |
20,171 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.bool | 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()
... | python | 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",
")",
":",
"v",
"=",
"self",
".",
"squeeze",
"(",
")",
"if",
"isinstance",
"(",
"v",
",",
"(",
"bool",
",",
"np",
".",
"bool_",
")",
")",
":",
"return",
"bool",
"(",
"v",
")",
"elif",
"is_scalar",
"(",
"v",
")",
":"... | 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 | [
"Return",
"the",
"bool",
"of",
"a",
"single",
"element",
"PandasObject",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1514-L1529 |
20,172 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._is_level_reference | 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)... | python | 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",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_level_reference is... | 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
... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1545-L1576 |
20,173 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._is_label_reference | 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
------... | python | 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",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_label_reference is not implemented for {type}\"",
".",
"format",
"(",
"type",
"=",
"ty... | 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... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"reference",
"for",
"a",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1578-L1608 |
20,174 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._is_label_or_level_reference | 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... | python | 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",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_is_label_or_level_reference is not implemented for {type}\"",
".",
"format",
"(",
"t... | 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
... | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"or",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1610-L1637 |
20,175 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._check_label_or_level_ambiguity | 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... | python | 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",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_check_label_or_level_ambiguity is not implemented for {type}\"",
".",
"format",
"("... | 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... | [
"Check",
"whether",
"key",
"is",
"ambiguous",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1639-L1686 |
20,176 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._get_label_or_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... | python | 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",
")",
":",
"if",
"self",
".",
"ndim",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"_get_label_or_level_values is not implemented for {type}\"",
".",
"format",
"(",
"type"... | 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... | [
"Return",
"a",
"1",
"-",
"D",
"array",
"of",
"values",
"associated",
"with",
"key",
"a",
"label",
"or",
"level",
"from",
"the",
"given",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1688-L1757 |
20,177 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.empty | 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
... | python | 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",
")",
":",
"return",
"any",
"(",
"len",
"(",
"self",
".",
"_get_axis",
"(",
"a",
")",
")",
"==",
"0",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
")"
] | 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
... | [
"Indicator",
"whether",
"DataFrame",
"is",
"empty",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1878-L1924 |
20,178 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._repr_data_resource_ | 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... | python | 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",
")",
":",
"if",
"config",
".",
"get_option",
"(",
"\"display.html.table_schema\"",
")",
":",
"data",
"=",
"self",
".",
"head",
"(",
"config",
".",
"get_option",
"(",
"'display.max_rows'",
")",
")",
"payload",
"=",
... | Not a real Jupyter special repr method, but we use the same
naming convention. | [
"Not",
"a",
"real",
"Jupyter",
"special",
"repr",
"method",
"but",
"we",
"use",
"the",
"same",
"naming",
"convention",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2021-L2030 |
20,179 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_json | 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 ... | python | 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",
"=",
... | 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... | [
"Convert",
"the",
"object",
"to",
"a",
"JSON",
"string",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2158-L2302 |
20,180 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_hdf | 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... | python | 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",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"pytables",
"return",
"pytables",
".",
"to_hdf",
"(",
"path_or_buf",
",",
"key",
",",
"self",
",",
"*",
"*",
"kwar... | 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... | [
"Write",
"the",
"contained",
"data",
"to",
"an",
"HDF5",
"file",
"using",
"HDFStore",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2304-L2406 |
20,181 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_msgpack | 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... | python | 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",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"packers",
"return",
"packers",
".",
"to_msgpack",
"(",
"path_or_buf",
",",
"sel... | 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... | [
"Serialize",
"object",
"to",
"input",
"file",
"path",
"using",
"msgpack",
"format",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2408-L2427 |
20,182 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_clipboard | 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
... | python | 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",
")",
":",
"from",
"pandas",
".",
"io",
"import",
"clipboards",
"clipboards",
".",
"to_clipboard",
"(",
"self",
",",
"excel",
"=",
"excel",
... | 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 ... | [
"r",
"Copy",
"object",
"to",
"the",
"system",
"clipboard",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2621-L2676 |
20,183 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_xarray | 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.
... | python | 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",
")",
":",
"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\"",
... | 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... | [
"Return",
"an",
"xarray",
"object",
"from",
"the",
"pandas",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2678-L2773 |
20,184 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.to_latex | 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... | python | 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_forma... | 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... | [
"r",
"Render",
"an",
"object",
"to",
"a",
"LaTeX",
"tabular",
"environment",
"table",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L2775-L2910 |
20,185 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._create_indexer | 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__)) | python | 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",
")",
":",
"if",
"getattr",
"(",
"cls",
",",
"name",
",",
"None",
")",
"is",
"None",
":",
"_indexer",
"=",
"functools",
".",
"partial",
"(",
"indexer",
",",
"name",
")",
"setattr",
"("... | Create an indexer like _name in the class. | [
"Create",
"an",
"indexer",
"like",
"_name",
"in",
"the",
"class",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3059-L3063 |
20,186 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._get_item_cache | def _get_item_cache(self, item):
"""Return the cached item, item represents a label indexer."""
cache = self._item_cache
res = cache.get(item)
if res is None:
values = self._data.get(item)
res = self._box_item_values(item, values)
cache[item] = res
... | python | def _get_item_cache(self, item):
"""Return the cached item, item represents a label indexer."""
cache = self._item_cache
res = cache.get(item)
if res is None:
values = self._data.get(item)
res = self._box_item_values(item, values)
cache[item] = res
... | [
"def",
"_get_item_cache",
"(",
"self",
",",
"item",
")",
":",
"cache",
"=",
"self",
".",
"_item_cache",
"res",
"=",
"cache",
".",
"get",
"(",
"item",
")",
"if",
"res",
"is",
"None",
":",
"values",
"=",
"self",
".",
"_data",
".",
"get",
"(",
"item",... | Return the cached item, item represents a label indexer. | [
"Return",
"the",
"cached",
"item",
"item",
"represents",
"a",
"label",
"indexer",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3086-L3098 |
20,187 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._set_as_cached | def _set_as_cached(self, item, cacher):
"""Set the _cacher attribute on the calling object with a weakref to
cacher.
"""
self._cacher = (item, weakref.ref(cacher)) | python | def _set_as_cached(self, item, cacher):
"""Set the _cacher attribute on the calling object with a weakref to
cacher.
"""
self._cacher = (item, weakref.ref(cacher)) | [
"def",
"_set_as_cached",
"(",
"self",
",",
"item",
",",
"cacher",
")",
":",
"self",
".",
"_cacher",
"=",
"(",
"item",
",",
"weakref",
".",
"ref",
"(",
"cacher",
")",
")"
] | Set the _cacher attribute on the calling object with a weakref to
cacher. | [
"Set",
"the",
"_cacher",
"attribute",
"on",
"the",
"calling",
"object",
"with",
"a",
"weakref",
"to",
"cacher",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3100-L3104 |
20,188 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._iget_item_cache | def _iget_item_cache(self, item):
"""Return the cached item, item represents a positional indexer."""
ax = self._info_axis
if ax.is_unique:
lower = self._get_item_cache(ax[item])
else:
lower = self._take(item, axis=self._info_axis_number)
return lower | python | def _iget_item_cache(self, item):
"""Return the cached item, item represents a positional indexer."""
ax = self._info_axis
if ax.is_unique:
lower = self._get_item_cache(ax[item])
else:
lower = self._take(item, axis=self._info_axis_number)
return lower | [
"def",
"_iget_item_cache",
"(",
"self",
",",
"item",
")",
":",
"ax",
"=",
"self",
".",
"_info_axis",
"if",
"ax",
".",
"is_unique",
":",
"lower",
"=",
"self",
".",
"_get_item_cache",
"(",
"ax",
"[",
"item",
"]",
")",
"else",
":",
"lower",
"=",
"self",... | Return the cached item, item represents a positional indexer. | [
"Return",
"the",
"cached",
"item",
"item",
"represents",
"a",
"positional",
"indexer",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3111-L3118 |
20,189 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._maybe_update_cacher | def _maybe_update_cacher(self, clear=False, verify_is_copy=True):
"""
See if we need to update our parent cacher if clear, then clear our
cache.
Parameters
----------
clear : boolean, default False
clear the item cache
verify_is_copy : boolean, defaul... | python | def _maybe_update_cacher(self, clear=False, verify_is_copy=True):
"""
See if we need to update our parent cacher if clear, then clear our
cache.
Parameters
----------
clear : boolean, default False
clear the item cache
verify_is_copy : boolean, defaul... | [
"def",
"_maybe_update_cacher",
"(",
"self",
",",
"clear",
"=",
"False",
",",
"verify_is_copy",
"=",
"True",
")",
":",
"cacher",
"=",
"getattr",
"(",
"self",
",",
"'_cacher'",
",",
"None",
")",
"if",
"cacher",
"is",
"not",
"None",
":",
"ref",
"=",
"cach... | See if we need to update our parent cacher if clear, then clear our
cache.
Parameters
----------
clear : boolean, default False
clear the item cache
verify_is_copy : boolean, default True
provide is_copy checks | [
"See",
"if",
"we",
"need",
"to",
"update",
"our",
"parent",
"cacher",
"if",
"clear",
"then",
"clear",
"our",
"cache",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3145-L3177 |
20,190 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._slice | def _slice(self, slobj, axis=0, kind=None):
"""
Construct a slice of this container.
kind parameter is maintained for compatibility with Series slicing.
"""
axis = self._get_block_manager_axis(axis)
result = self._constructor(self._data.get_slice(slobj, axis=axis))
... | python | def _slice(self, slobj, axis=0, kind=None):
"""
Construct a slice of this container.
kind parameter is maintained for compatibility with Series slicing.
"""
axis = self._get_block_manager_axis(axis)
result = self._constructor(self._data.get_slice(slobj, axis=axis))
... | [
"def",
"_slice",
"(",
"self",
",",
"slobj",
",",
"axis",
"=",
"0",
",",
"kind",
"=",
"None",
")",
":",
"axis",
"=",
"self",
".",
"_get_block_manager_axis",
"(",
"axis",
")",
"result",
"=",
"self",
".",
"_constructor",
"(",
"self",
".",
"_data",
".",
... | Construct a slice of this container.
kind parameter is maintained for compatibility with Series slicing. | [
"Construct",
"a",
"slice",
"of",
"this",
"container",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3185-L3199 |
20,191 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._check_is_chained_assignment_possible | def _check_is_chained_assignment_possible(self):
"""
Check if we are a view, have a cacher, and are of mixed type.
If so, then force a setitem_copy check.
Should be called just near setting a value
Will return a boolean if it we are a view and are cached, but a
single-d... | python | def _check_is_chained_assignment_possible(self):
"""
Check if we are a view, have a cacher, and are of mixed type.
If so, then force a setitem_copy check.
Should be called just near setting a value
Will return a boolean if it we are a view and are cached, but a
single-d... | [
"def",
"_check_is_chained_assignment_possible",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_view",
"and",
"self",
".",
"_is_cached",
":",
"ref",
"=",
"self",
".",
"_get_cacher",
"(",
")",
"if",
"ref",
"is",
"not",
"None",
"and",
"ref",
".",
"_is_mixed_t... | Check if we are a view, have a cacher, and are of mixed type.
If so, then force a setitem_copy check.
Should be called just near setting a value
Will return a boolean if it we are a view and are cached, but a
single-dtype meaning that the cacher should be updated following
sett... | [
"Check",
"if",
"we",
"are",
"a",
"view",
"have",
"a",
"cacher",
"and",
"are",
"of",
"mixed",
"type",
".",
"If",
"so",
"then",
"force",
"a",
"setitem_copy",
"check",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3214-L3233 |
20,192 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.select | def select(self, crit, axis=0):
"""
Return data corresponding to axis labels matching criteria.
.. deprecated:: 0.21.0
Use df.loc[df.index.map(crit)] to select via labels
Parameters
----------
crit : function
To be called on each index (label). S... | python | def select(self, crit, axis=0):
"""
Return data corresponding to axis labels matching criteria.
.. deprecated:: 0.21.0
Use df.loc[df.index.map(crit)] to select via labels
Parameters
----------
crit : function
To be called on each index (label). S... | [
"def",
"select",
"(",
"self",
",",
"crit",
",",
"axis",
"=",
"0",
")",
":",
"warnings",
".",
"warn",
"(",
"\"'select' is deprecated and will be removed in a \"",
"\"future release. You can use \"",
"\".loc[labels.map(crit)] as a replacement\"",
",",
"FutureWarning",
",",
... | Return data corresponding to axis labels matching criteria.
.. deprecated:: 0.21.0
Use df.loc[df.index.map(crit)] to select via labels
Parameters
----------
crit : function
To be called on each index (label). Should return True or False
axis : int
... | [
"Return",
"data",
"corresponding",
"to",
"axis",
"labels",
"matching",
"criteria",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3653-L3685 |
20,193 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.reindex_like | def reindex_like(self, other, method=None, copy=True, limit=None,
tolerance=None):
"""
Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional
filling logic, placing NaN in locations having no value
... | python | def reindex_like(self, other, method=None, copy=True, limit=None,
tolerance=None):
"""
Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional
filling logic, placing NaN in locations having no value
... | [
"def",
"reindex_like",
"(",
"self",
",",
"other",
",",
"method",
"=",
"None",
",",
"copy",
"=",
"True",
",",
"limit",
"=",
"None",
",",
"tolerance",
"=",
"None",
")",
":",
"d",
"=",
"other",
".",
"_construct_axes_dict",
"(",
"axes",
"=",
"self",
".",... | Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional
filling logic, placing NaN in locations having no value
in the previous index. A new object is produced unless the
new index is equivalent to the current one and copy=False... | [
"Return",
"an",
"object",
"with",
"matching",
"indices",
"as",
"other",
"object",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3687-L3787 |
20,194 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._drop_axis | def _drop_axis(self, labels, axis, level=None, errors='raise'):
"""
Drop labels from specified axis. Used in the ``drop`` method
internally.
Parameters
----------
labels : single label or list-like
axis : int or axis name
level : int or level name, defaul... | python | def _drop_axis(self, labels, axis, level=None, errors='raise'):
"""
Drop labels from specified axis. Used in the ``drop`` method
internally.
Parameters
----------
labels : single label or list-like
axis : int or axis name
level : int or level name, defaul... | [
"def",
"_drop_axis",
"(",
"self",
",",
"labels",
",",
"axis",
",",
"level",
"=",
"None",
",",
"errors",
"=",
"'raise'",
")",
":",
"axis",
"=",
"self",
".",
"_get_axis_number",
"(",
"axis",
")",
"axis_name",
"=",
"self",
".",
"_get_axis_name",
"(",
"axi... | Drop labels from specified axis. Used in the ``drop`` method
internally.
Parameters
----------
labels : single label or list-like
axis : int or axis name
level : int or level name, default None
For MultiIndex
errors : {'ignore', 'raise'}, default 'rai... | [
"Drop",
"labels",
"from",
"specified",
"axis",
".",
"Used",
"in",
"the",
"drop",
"method",
"internally",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3817-L3868 |
20,195 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._update_inplace | def _update_inplace(self, result, verify_is_copy=True):
"""
Replace self internals with result.
Parameters
----------
verify_is_copy : boolean, default True
provide is_copy checks
"""
# NOTE: This does *not* call __finalize__ and that's an explicit
... | python | def _update_inplace(self, result, verify_is_copy=True):
"""
Replace self internals with result.
Parameters
----------
verify_is_copy : boolean, default True
provide is_copy checks
"""
# NOTE: This does *not* call __finalize__ and that's an explicit
... | [
"def",
"_update_inplace",
"(",
"self",
",",
"result",
",",
"verify_is_copy",
"=",
"True",
")",
":",
"# NOTE: This does *not* call __finalize__ and that's an explicit",
"# decision that we may revisit in the future.",
"self",
".",
"_reset_cache",
"(",
")",
"self",
".",
"_cle... | Replace self internals with result.
Parameters
----------
verify_is_copy : boolean, default True
provide is_copy checks | [
"Replace",
"self",
"internals",
"with",
"result",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3870-L3886 |
20,196 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.add_prefix | def add_prefix(self, prefix):
"""
Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
... | python | def add_prefix(self, prefix):
"""
Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
... | [
"def",
"add_prefix",
"(",
"self",
",",
"prefix",
")",
":",
"f",
"=",
"functools",
".",
"partial",
"(",
"'{prefix}{}'",
".",
"format",
",",
"prefix",
"=",
"prefix",
")",
"mapper",
"=",
"{",
"self",
".",
"_info_axis_name",
":",
"f",
"}",
"return",
"self"... | Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
-------
Series or DataFrame
... | [
"Prefix",
"labels",
"with",
"string",
"prefix",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3888-L3945 |
20,197 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.add_suffix | def add_suffix(self, suffix):
"""
Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
Returns
... | python | def add_suffix(self, suffix):
"""
Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
Returns
... | [
"def",
"add_suffix",
"(",
"self",
",",
"suffix",
")",
":",
"f",
"=",
"functools",
".",
"partial",
"(",
"'{}{suffix}'",
".",
"format",
",",
"suffix",
"=",
"suffix",
")",
"mapper",
"=",
"{",
"self",
".",
"_info_axis_name",
":",
"f",
"}",
"return",
"self"... | Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
Returns
-------
Series or DataFrame
... | [
"Suffix",
"labels",
"with",
"string",
"suffix",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L3947-L4004 |
20,198 | pandas-dev/pandas | pandas/core/generic.py | NDFrame.sort_values | def sort_values(self, by=None, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
"""
Sort by the values along either axis.
Parameters
----------%(optional_by)s
axis : %(axes_single_arg)s, default 0
Axis to be sorted.
... | python | def sort_values(self, by=None, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
"""
Sort by the values along either axis.
Parameters
----------%(optional_by)s
axis : %(axes_single_arg)s, default 0
Axis to be sorted.
... | [
"def",
"sort_values",
"(",
"self",
",",
"by",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"ascending",
"=",
"True",
",",
"inplace",
"=",
"False",
",",
"kind",
"=",
"'quicksort'",
",",
"na_position",
"=",
"'last'",
")",
":",
"raise",
"NotImplementedError",
... | Sort by the values along either axis.
Parameters
----------%(optional_by)s
axis : %(axes_single_arg)s, default 0
Axis to be sorted.
ascending : bool or list of bool, default True
Sort ascending vs. descending. Specify list for multiple sort
orders.... | [
"Sort",
"by",
"the",
"values",
"along",
"either",
"axis",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4006-L4096 |
20,199 | pandas-dev/pandas | pandas/core/generic.py | NDFrame._reindex_axes | def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,
copy):
"""Perform the reindex for all the axes."""
obj = self
for a in self._AXIS_ORDERS:
labels = axes[a]
if labels is None:
continue
ax = self._... | python | def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,
copy):
"""Perform the reindex for all the axes."""
obj = self
for a in self._AXIS_ORDERS:
labels = axes[a]
if labels is None:
continue
ax = self._... | [
"def",
"_reindex_axes",
"(",
"self",
",",
"axes",
",",
"level",
",",
"limit",
",",
"tolerance",
",",
"method",
",",
"fill_value",
",",
"copy",
")",
":",
"obj",
"=",
"self",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
":",
"labels",
"=",
"axes",
"[... | Perform the reindex for all the axes. | [
"Perform",
"the",
"reindex",
"for",
"all",
"the",
"axes",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4393-L4411 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.