repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
pandas-dev/pandas | pandas/io/pytables.py | IndexCol.set_info | def set_info(self, info):
""" set my state from the passed info """
idx = info.get(self.name)
if idx is not None:
self.__dict__.update(idx) | python | def set_info(self, info):
""" set my state from the passed info """
idx = info.get(self.name)
if idx is not None:
self.__dict__.update(idx) | [
"def",
"set_info",
"(",
"self",
",",
"info",
")",
":",
"idx",
"=",
"info",
".",
"get",
"(",
"self",
".",
"name",
")",
"if",
"idx",
"is",
"not",
"None",
":",
"self",
".",
"__dict__",
".",
"update",
"(",
"idx",
")"
] | set my state from the passed info | [
"set",
"my",
"state",
"from",
"the",
"passed",
"info"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1766-L1770 | train |
pandas-dev/pandas | pandas/io/pytables.py | IndexCol.validate_metadata | def validate_metadata(self, handler):
""" validate that kind=category does not change the categories """
if self.meta == 'category':
new_metadata = self.metadata
cur_metadata = handler.read_metadata(self.cname)
if (new_metadata is not None and cur_metadata is not None... | python | def validate_metadata(self, handler):
""" validate that kind=category does not change the categories """
if self.meta == 'category':
new_metadata = self.metadata
cur_metadata = handler.read_metadata(self.cname)
if (new_metadata is not None and cur_metadata is not None... | [
"def",
"validate_metadata",
"(",
"self",
",",
"handler",
")",
":",
"if",
"self",
".",
"meta",
"==",
"'category'",
":",
"new_metadata",
"=",
"self",
".",
"metadata",
"cur_metadata",
"=",
"handler",
".",
"read_metadata",
"(",
"self",
".",
"cname",
")",
"if",... | validate that kind=category does not change the categories | [
"validate",
"that",
"kind",
"=",
"category",
"does",
"not",
"change",
"the",
"categories"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1784-L1792 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | GenericIndexCol.convert | def convert(self, values, nan_rep, encoding, errors):
""" set the values from this selection: take = take ownership """
self.values = Int64Index(np.arange(self.table.nrows))
return self | python | def convert(self, values, nan_rep, encoding, errors):
""" set the values from this selection: take = take ownership """
self.values = Int64Index(np.arange(self.table.nrows))
return self | [
"def",
"convert",
"(",
"self",
",",
"values",
",",
"nan_rep",
",",
"encoding",
",",
"errors",
")",
":",
"self",
".",
"values",
"=",
"Int64Index",
"(",
"np",
".",
"arange",
"(",
"self",
".",
"table",
".",
"nrows",
")",
")",
"return",
"self"
] | set the values from this selection: take = take ownership | [
"set",
"the",
"values",
"from",
"this",
"selection",
":",
"take",
"=",
"take",
"ownership"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1808-L1812 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | DataCol.convert | def convert(self, values, nan_rep, encoding, errors):
"""set the data from this selection (and convert to the correct dtype
if we can)
"""
# values is a recarray
if values.dtype.fields is not None:
values = values[self.cname]
self.set_data(values)
#... | python | def convert(self, values, nan_rep, encoding, errors):
"""set the data from this selection (and convert to the correct dtype
if we can)
"""
# values is a recarray
if values.dtype.fields is not None:
values = values[self.cname]
self.set_data(values)
#... | [
"def",
"convert",
"(",
"self",
",",
"values",
",",
"nan_rep",
",",
"encoding",
",",
"errors",
")",
":",
"# values is a recarray",
"if",
"values",
".",
"dtype",
".",
"fields",
"is",
"not",
"None",
":",
"values",
"=",
"values",
"[",
"self",
".",
"cname",
... | set the data from this selection (and convert to the correct dtype
if we can) | [
"set",
"the",
"data",
"from",
"this",
"selection",
"(",
"and",
"convert",
"to",
"the",
"correct",
"dtype",
"if",
"we",
"can",
")"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2154-L2230 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Fixed.delete | def delete(self, where=None, start=None, stop=None, **kwargs):
"""
support fully deleting the node in its entirety (only) - where
specification must be None
"""
if com._all_none(where, start, stop):
self._handle.remove_node(self.group, recursive=True)
retu... | python | def delete(self, where=None, start=None, stop=None, **kwargs):
"""
support fully deleting the node in its entirety (only) - where
specification must be None
"""
if com._all_none(where, start, stop):
self._handle.remove_node(self.group, recursive=True)
retu... | [
"def",
"delete",
"(",
"self",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"com",
".",
"_all_none",
"(",
"where",
",",
"start",
",",
"stop",
")",
":",
"self",
".",
"_ha... | support fully deleting the node in its entirety (only) - where
specification must be None | [
"support",
"fully",
"deleting",
"the",
"node",
"in",
"its",
"entirety",
"(",
"only",
")",
"-",
"where",
"specification",
"must",
"be",
"None"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2434-L2443 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | GenericFixed.get_attrs | def get_attrs(self):
""" retrieve our attributes """
self.encoding = _ensure_encoding(getattr(self.attrs, 'encoding', None))
self.errors = _ensure_decoded(getattr(self.attrs, 'errors', 'strict'))
for n in self.attributes:
setattr(self, n, _ensure_decoded(getattr(self.attrs, n... | python | def get_attrs(self):
""" retrieve our attributes """
self.encoding = _ensure_encoding(getattr(self.attrs, 'encoding', None))
self.errors = _ensure_decoded(getattr(self.attrs, 'errors', 'strict'))
for n in self.attributes:
setattr(self, n, _ensure_decoded(getattr(self.attrs, n... | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"encoding",
"=",
"_ensure_encoding",
"(",
"getattr",
"(",
"self",
".",
"attrs",
",",
"'encoding'",
",",
"None",
")",
")",
"self",
".",
"errors",
"=",
"_ensure_decoded",
"(",
"getattr",
"(",
"self",
... | retrieve our attributes | [
"retrieve",
"our",
"attributes"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L2508-L2513 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.validate_metadata | def validate_metadata(self, existing):
""" create / validate metadata """
self.metadata = [
c.name for c in self.values_axes if c.metadata is not None] | python | def validate_metadata(self, existing):
""" create / validate metadata """
self.metadata = [
c.name for c in self.values_axes if c.metadata is not None] | [
"def",
"validate_metadata",
"(",
"self",
",",
"existing",
")",
":",
"self",
".",
"metadata",
"=",
"[",
"c",
".",
"name",
"for",
"c",
"in",
"self",
".",
"values_axes",
"if",
"c",
".",
"metadata",
"is",
"not",
"None",
"]"
] | create / validate metadata | [
"create",
"/",
"validate",
"metadata"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3130-L3133 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.get_attrs | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = getattr(
self.attrs, 'non_index_axes', None) or []
self.data_columns = getattr(
self.attrs, 'data_columns', None) or []
self.info = getattr(
self.attrs, 'info', None) or dict()
... | python | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = getattr(
self.attrs, 'non_index_axes', None) or []
self.data_columns = getattr(
self.attrs, 'data_columns', None) or []
self.info = getattr(
self.attrs, 'info', None) or dict()
... | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"non_index_axes",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",
"'non_index_axes'",
",",
"None",
")",
"or",
"[",
"]",
"self",
".",
"data_columns",
"=",
"getattr",
"(",
"self",
".",
"attrs",
",",... | retrieve our attributes | [
"retrieve",
"our",
"attributes"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3257-L3278 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.indexables | def indexables(self):
""" create/cache the indexables if they don't exist """
if self._indexables is None:
self._indexables = []
# index columns
self._indexables.extend([
IndexCol(name=name, axis=axis, pos=i)
for i, (axis, name) in en... | python | def indexables(self):
""" create/cache the indexables if they don't exist """
if self._indexables is None:
self._indexables = []
# index columns
self._indexables.extend([
IndexCol(name=name, axis=axis, pos=i)
for i, (axis, name) in en... | [
"def",
"indexables",
"(",
"self",
")",
":",
"if",
"self",
".",
"_indexables",
"is",
"None",
":",
"self",
".",
"_indexables",
"=",
"[",
"]",
"# index columns",
"self",
".",
"_indexables",
".",
"extend",
"(",
"[",
"IndexCol",
"(",
"name",
"=",
"name",
",... | create/cache the indexables if they don't exist | [
"create",
"/",
"cache",
"the",
"indexables",
"if",
"they",
"don",
"t",
"exist"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3310-L3336 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.create_index | def create_index(self, columns=None, optlevel=None, kind=None):
"""
Create a pytables index on the specified columns
note: cannot index Time64Col() or ComplexCol currently;
PyTables must be >= 3.0
Parameters
----------
columns : False (don't create an index),... | python | def create_index(self, columns=None, optlevel=None, kind=None):
"""
Create a pytables index on the specified columns
note: cannot index Time64Col() or ComplexCol currently;
PyTables must be >= 3.0
Parameters
----------
columns : False (don't create an index),... | [
"def",
"create_index",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"optlevel",
"=",
"None",
",",
"kind",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"infer_axes",
"(",
")",
":",
"return",
"if",
"columns",
"is",
"False",
":",
"return",
"# inde... | Create a pytables index on the specified columns
note: cannot index Time64Col() or ComplexCol currently;
PyTables must be >= 3.0
Parameters
----------
columns : False (don't create an index), True (create all columns
index), None or list_like (the indexers to ind... | [
"Create",
"a",
"pytables",
"index",
"on",
"the",
"specified",
"columns",
"note",
":",
"cannot",
"index",
"Time64Col",
"()",
"or",
"ComplexCol",
"currently",
";",
"PyTables",
"must",
"be",
">",
"=",
"3",
".",
"0"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3338-L3405 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.read_axes | def read_axes(self, where, **kwargs):
"""create and return the axes sniffed from the table: return boolean
for success
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
return False
# cre... | python | def read_axes(self, where, **kwargs):
"""create and return the axes sniffed from the table: return boolean
for success
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
return False
# cre... | [
"def",
"read_axes",
"(",
"self",
",",
"where",
",",
"*",
"*",
"kwargs",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
"where",
")",
"# infer the data kind",
"if",
"not",
"self",
".",
"infer_axes",
"(",
")",
":",
"return",
"False",... | create and return the axes sniffed from the table: return boolean
for success | [
"create",
"and",
"return",
"the",
"axes",
"sniffed",
"from",
"the",
"table",
":",
"return",
"boolean",
"for",
"success"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3407-L3429 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.create_axes | def create_axes(self, axes, obj, validate=True, nan_rep=None,
data_columns=None, min_itemsize=None, **kwargs):
""" create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
... | python | def create_axes(self, axes, obj, validate=True, nan_rep=None,
data_columns=None, min_itemsize=None, **kwargs):
""" create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
... | [
"def",
"create_axes",
"(",
"self",
",",
"axes",
",",
"obj",
",",
"validate",
"=",
"True",
",",
"nan_rep",
"=",
"None",
",",
"data_columns",
"=",
"None",
",",
"min_itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# set the default axes if needed"... | create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
axes: a list of the axes in order to create (names or numbers of
the axes)
obj : the object to create axes o... | [
"create",
"and",
"return",
"the",
"axes",
"leagcy",
"tables",
"create",
"an",
"indexable",
"column",
"indexable",
"index",
"non",
"-",
"indexable",
"fields"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3468-L3681 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Table.read_coordinates | def read_coordinates(self, where=None, start=None, stop=None, **kwargs):
"""select coordinates (row numbers) from a table; return the
coordinates object
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
... | python | def read_coordinates(self, where=None, start=None, stop=None, **kwargs):
"""select coordinates (row numbers) from a table; return the
coordinates object
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
... | [
"def",
"read_coordinates",
"(",
"self",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
"where",
")",
"# infer the data kind",
... | select coordinates (row numbers) from a table; return the
coordinates object | [
"select",
"coordinates",
"(",
"row",
"numbers",
")",
"from",
"a",
"table",
";",
"return",
"the",
"coordinates",
"object"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3768-L3791 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | AppendableTable.write_data_chunk | def write_data_chunk(self, rows, indexes, mask, values):
"""
Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values
"""
# 0 l... | python | def write_data_chunk(self, rows, indexes, mask, values):
"""
Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values
"""
# 0 l... | [
"def",
"write_data_chunk",
"(",
"self",
",",
"rows",
",",
"indexes",
",",
"mask",
",",
"values",
")",
":",
"# 0 len",
"for",
"v",
"in",
"values",
":",
"if",
"not",
"np",
".",
"prod",
"(",
"v",
".",
"shape",
")",
":",
"return",
"try",
":",
"nrows",
... | Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values | [
"Parameters",
"----------",
"rows",
":",
"an",
"empty",
"memory",
"space",
"where",
"we",
"are",
"putting",
"the",
"chunk",
"indexes",
":",
"an",
"array",
"of",
"the",
"indexes",
"mask",
":",
"an",
"array",
"of",
"the",
"masks",
"values",
":",
"an",
"arr... | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4005-L4052 | train |
pandas-dev/pandas | pandas/io/pytables.py | AppendableSeriesTable.write | def write(self, obj, data_columns=None, **kwargs):
""" we are going to write this as a frame table """
if not isinstance(obj, DataFrame):
name = obj.name or 'values'
obj = DataFrame({name: obj}, index=obj.index)
obj.columns = [name]
return super().write(obj=ob... | python | def write(self, obj, data_columns=None, **kwargs):
""" we are going to write this as a frame table """
if not isinstance(obj, DataFrame):
name = obj.name or 'values'
obj = DataFrame({name: obj}, index=obj.index)
obj.columns = [name]
return super().write(obj=ob... | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"data_columns",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"DataFrame",
")",
":",
"name",
"=",
"obj",
".",
"name",
"or",
"'values'",
"obj",
"=",
"DataFra... | we are going to write this as a frame table | [
"we",
"are",
"going",
"to",
"write",
"this",
"as",
"a",
"frame",
"table"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4196-L4203 | train |
pandas-dev/pandas | pandas/io/pytables.py | AppendableMultiSeriesTable.write | def write(self, obj, **kwargs):
""" we are going to write this as a frame table """
name = obj.name or 'values'
obj, self.levels = self.validate_multiindex(obj)
cols = list(self.levels)
cols.append(name)
obj.columns = cols
return super().write(obj=obj, **kwargs) | python | def write(self, obj, **kwargs):
""" we are going to write this as a frame table """
name = obj.name or 'values'
obj, self.levels = self.validate_multiindex(obj)
cols = list(self.levels)
cols.append(name)
obj.columns = cols
return super().write(obj=obj, **kwargs) | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"obj",
".",
"name",
"or",
"'values'",
"obj",
",",
"self",
".",
"levels",
"=",
"self",
".",
"validate_multiindex",
"(",
"obj",
")",
"cols",
"=",
"list",
"(",
... | we are going to write this as a frame table | [
"we",
"are",
"going",
"to",
"write",
"this",
"as",
"a",
"frame",
"table"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4229-L4236 | train |
pandas-dev/pandas | pandas/io/pytables.py | GenericTable.get_attrs | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = []
self.nan_rep = None
self.levels = []
self.index_axes = [a.infer(self)
for a in self.indexables if a.is_an_indexable]
self.values_axes = [a.infer(self)
... | python | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = []
self.nan_rep = None
self.levels = []
self.index_axes = [a.infer(self)
for a in self.indexables if a.is_an_indexable]
self.values_axes = [a.infer(self)
... | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"non_index_axes",
"=",
"[",
"]",
"self",
".",
"nan_rep",
"=",
"None",
"self",
".",
"levels",
"=",
"[",
"]",
"self",
".",
"index_axes",
"=",
"[",
"a",
".",
"infer",
"(",
"self",
")",
"for",
"... | retrieve our attributes | [
"retrieve",
"our",
"attributes"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4254-L4264 | train |
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 | train |
pandas-dev/pandas | pandas/io/pytables.py | Selection.generate | def generate(self, where):
""" where can be a : dict,list,tuple,string """
if where is None:
return None
q = self.table.queryables()
try:
return Expr(where, queryables=q, encoding=self.table.encoding)
except NameError:
# raise a nice message, ... | python | def generate(self, where):
""" where can be a : dict,list,tuple,string """
if where is None:
return None
q = self.table.queryables()
try:
return Expr(where, queryables=q, encoding=self.table.encoding)
except NameError:
# raise a nice message, ... | [
"def",
"generate",
"(",
"self",
",",
"where",
")",
":",
"if",
"where",
"is",
"None",
":",
"return",
"None",
"q",
"=",
"self",
".",
"table",
".",
"queryables",
"(",
")",
"try",
":",
"return",
"Expr",
"(",
"where",
",",
"queryables",
"=",
"q",
",",
... | where can be a : dict,list,tuple,string | [
"where",
"can",
"be",
"a",
":",
"dict",
"list",
"tuple",
"string"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4679-L4699 | train |
pandas-dev/pandas | pandas/io/pytables.py | Selection.select | def select(self):
"""
generate the selection
"""
if self.condition is not None:
return self.table.table.read_where(self.condition.format(),
start=self.start,
stop=self.stop)
... | python | def select(self):
"""
generate the selection
"""
if self.condition is not None:
return self.table.table.read_where(self.condition.format(),
start=self.start,
stop=self.stop)
... | [
"def",
"select",
"(",
"self",
")",
":",
"if",
"self",
".",
"condition",
"is",
"not",
"None",
":",
"return",
"self",
".",
"table",
".",
"table",
".",
"read_where",
"(",
"self",
".",
"condition",
".",
"format",
"(",
")",
",",
"start",
"=",
"self",
".... | generate the selection | [
"generate",
"the",
"selection"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4701-L4711 | train |
pandas-dev/pandas | pandas/io/pytables.py | Selection.select_coords | def select_coords(self):
"""
generate the selection
"""
start, stop = self.start, self.stop
nrows = self.table.nrows
if start is None:
start = 0
elif start < 0:
start += nrows
if self.stop is None:
stop = nrows
e... | python | def select_coords(self):
"""
generate the selection
"""
start, stop = self.start, self.stop
nrows = self.table.nrows
if start is None:
start = 0
elif start < 0:
start += nrows
if self.stop is None:
stop = nrows
e... | [
"def",
"select_coords",
"(",
"self",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"start",
",",
"self",
".",
"stop",
"nrows",
"=",
"self",
".",
"table",
".",
"nrows",
"if",
"start",
"is",
"None",
":",
"start",
"=",
"0",
"elif",
"start",
"<",
... | generate the selection | [
"generate",
"the",
"selection"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L4713-L4735 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.fillna | def fillna(self, value=None, method=None, limit=None):
"""
Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, array-like
If a scalar value is passed it is used to fill all missing values.
Alternatively, an array-like 'val... | python | def fillna(self, value=None, method=None, limit=None):
"""
Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, array-like
If a scalar value is passed it is used to fill all missing values.
Alternatively, an array-like 'val... | [
"def",
"fillna",
"(",
"self",
",",
"value",
"=",
"None",
",",
"method",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"from",
"pandas",
".",
"api",
".",
"types",
"import",
"is_array_like",
"from",
"pandas",
".",
"util",
".",
"_validators",
"import"... | Fill NA/NaN values using the specified method.
Parameters
----------
value : scalar, array-like
If a scalar value is passed it is used to fill all missing values.
Alternatively, an array-like 'value' can be given. It's expected
that the array-like have the sa... | [
"Fill",
"NA",
"/",
"NaN",
"values",
"using",
"the",
"specified",
"method",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L415-L467 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.searchsorted | def searchsorted(self, value, side="left", sorter=None):
"""
Find indices where elements should be inserted to maintain order.
.. versionadded:: 0.24.0
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the i... | python | def searchsorted(self, value, side="left", sorter=None):
"""
Find indices where elements should be inserted to maintain order.
.. versionadded:: 0.24.0
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the i... | [
"def",
"searchsorted",
"(",
"self",
",",
"value",
",",
"side",
"=",
"\"left\"",
",",
"sorter",
"=",
"None",
")",
":",
"# Note: the base tests provided by pandas only test the basics.",
"# We do not test",
"# 1. Values outside the range of the `data_for_sorting` fixture",
"# 2. ... | Find indices where elements should be inserted to maintain order.
.. versionadded:: 0.24.0
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the indices,
the order of `self` would be preserved.
Assuming tha... | [
"Find",
"indices",
"where",
"elements",
"should",
"be",
"inserted",
"to",
"maintain",
"order",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L550-L596 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/arrays/base.py | ExtensionArray.take | def take(
self,
indices: Sequence[int],
allow_fill: bool = False,
fill_value: Any = None
) -> ABCExtensionArray:
"""
Take elements from an array.
Parameters
----------
indices : sequence of integers
Indices to be ta... | python | def take(
self,
indices: Sequence[int],
allow_fill: bool = False,
fill_value: Any = None
) -> ABCExtensionArray:
"""
Take elements from an array.
Parameters
----------
indices : sequence of integers
Indices to be ta... | [
"def",
"take",
"(",
"self",
",",
"indices",
":",
"Sequence",
"[",
"int",
"]",
",",
"allow_fill",
":",
"bool",
"=",
"False",
",",
"fill_value",
":",
"Any",
"=",
"None",
")",
"->",
"ABCExtensionArray",
":",
"# Implementer note: The `fill_value` parameter should be... | Take elements from an array.
Parameters
----------
indices : sequence of integers
Indices to be taken.
allow_fill : bool, default False
How to handle negative values in `indices`.
* False: negative values in `indices` indicate positional indices
... | [
"Take",
"elements",
"from",
"an",
"array",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/base.py#L727-L819 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin.equals | def equals(self, other):
"""
Determines if two Index objects contain the same elements.
"""
if self.is_(other):
return True
if not isinstance(other, ABCIndexClass):
return False
elif not isinstance(other, type(self)):
try:
... | python | def equals(self, other):
"""
Determines if two Index objects contain the same elements.
"""
if self.is_(other):
return True
if not isinstance(other, ABCIndexClass):
return False
elif not isinstance(other, type(self)):
try:
... | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"is_",
"(",
"other",
")",
":",
"return",
"True",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ABCIndexClass",
")",
":",
"return",
"False",
"elif",
"not",
"isinstance",
"(",
"o... | Determines if two Index objects contain the same elements. | [
"Determines",
"if",
"two",
"Index",
"objects",
"contain",
"the",
"same",
"elements",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L143-L168 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._format_attrs | def _format_attrs(self):
"""
Return a list of tuples of the (attr,formatted_value).
"""
attrs = super()._format_attrs()
for attrib in self._attributes:
if attrib == 'freq':
freq = self.freqstr
if freq is not None:
fr... | python | def _format_attrs(self):
"""
Return a list of tuples of the (attr,formatted_value).
"""
attrs = super()._format_attrs()
for attrib in self._attributes:
if attrib == 'freq':
freq = self.freqstr
if freq is not None:
fr... | [
"def",
"_format_attrs",
"(",
"self",
")",
":",
"attrs",
"=",
"super",
"(",
")",
".",
"_format_attrs",
"(",
")",
"for",
"attrib",
"in",
"self",
".",
"_attributes",
":",
"if",
"attrib",
"==",
"'freq'",
":",
"freq",
"=",
"self",
".",
"freqstr",
"if",
"f... | Return a list of tuples of the (attr,formatted_value). | [
"Return",
"a",
"list",
"of",
"tuples",
"of",
"the",
"(",
"attr",
"formatted_value",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L439-L450 | train |
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 | train |
pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._add_datetimelike_methods | def _add_datetimelike_methods(cls):
"""
Add in the datetimelike methods (as we may have to override the
superclass).
"""
def __add__(self, other):
# dispatch to ExtensionArray implementation
result = self._data.__add__(maybe_unwrap_index(other))
... | python | def _add_datetimelike_methods(cls):
"""
Add in the datetimelike methods (as we may have to override the
superclass).
"""
def __add__(self, other):
# dispatch to ExtensionArray implementation
result = self._data.__add__(maybe_unwrap_index(other))
... | [
"def",
"_add_datetimelike_methods",
"(",
"cls",
")",
":",
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"# dispatch to ExtensionArray implementation",
"result",
"=",
"self",
".",
"_data",
".",
"__add__",
"(",
"maybe_unwrap_index",
"(",
"other",
")",
")"... | Add in the datetimelike methods (as we may have to override the
superclass). | [
"Add",
"in",
"the",
"datetimelike",
"methods",
"(",
"as",
"we",
"may",
"have",
"to",
"override",
"the",
"superclass",
")",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L480-L509 | train |
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 | train |
pandas-dev/pandas | pandas/core/indexes/datetimelike.py | DatetimeIndexOpsMixin._summary | def _summary(self, name=None):
"""
Return a summarized representation.
Parameters
----------
name : str
name to use in the summary representation
Returns
-------
String with a summarized representation of the index
"""
formatt... | python | def _summary(self, name=None):
"""
Return a summarized representation.
Parameters
----------
name : str
name to use in the summary representation
Returns
-------
String with a summarized representation of the index
"""
formatt... | [
"def",
"_summary",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"formatter",
"=",
"self",
".",
"_formatter_func",
"if",
"len",
"(",
"self",
")",
">",
"0",
":",
"index_summary",
"=",
"', %s to %s'",
"%",
"(",
"formatter",
"(",
"self",
"[",
"0",
"]... | Return a summarized representation.
Parameters
----------
name : str
name to use in the summary representation
Returns
-------
String with a summarized representation of the index | [
"Return",
"a",
"summarized",
"representation",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L547-L576 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._construct_axes_dict | def _construct_axes_dict(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {a: self._get_axis(a) for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | python | def _construct_axes_dict(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {a: self._get_axis(a) for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | [
"def",
"_construct_axes_dict",
"(",
"self",
",",
"axes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"a",
":",
"self",
".",
"_get_axis",
"(",
"a",
")",
"for",
"a",
"in",
"(",
"axes",
"or",
"self",
".",
"_AXIS_ORDERS",
")",
"}",... | Return an axes dictionary for myself. | [
"Return",
"an",
"axes",
"dictionary",
"for",
"myself",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L274-L278 | train |
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 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._construct_axes_dict_for_slice | def _construct_axes_dict_for_slice(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {self._AXIS_SLICEMAP[a]: self._get_axis(a)
for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | python | def _construct_axes_dict_for_slice(self, axes=None, **kwargs):
"""Return an axes dictionary for myself."""
d = {self._AXIS_SLICEMAP[a]: self._get_axis(a)
for a in (axes or self._AXIS_ORDERS)}
d.update(kwargs)
return d | [
"def",
"_construct_axes_dict_for_slice",
"(",
"self",
",",
"axes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"self",
".",
"_AXIS_SLICEMAP",
"[",
"a",
"]",
":",
"self",
".",
"_get_axis",
"(",
"a",
")",
"for",
"a",
"in",
"(",
"ax... | Return an axes dictionary for myself. | [
"Return",
"an",
"axes",
"dictionary",
"for",
"myself",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L287-L292 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame._construct_axes_from_arguments | def _construct_axes_from_arguments(
self, args, kwargs, require_all=False, sentinel=None):
"""Construct and returns axes if supplied in args/kwargs.
If require_all, raise if all axis arguments are not supplied
return a tuple of (axes, kwargs).
sentinel specifies the default... | python | def _construct_axes_from_arguments(
self, args, kwargs, require_all=False, sentinel=None):
"""Construct and returns axes if supplied in args/kwargs.
If require_all, raise if all axis arguments are not supplied
return a tuple of (axes, kwargs).
sentinel specifies the default... | [
"def",
"_construct_axes_from_arguments",
"(",
"self",
",",
"args",
",",
"kwargs",
",",
"require_all",
"=",
"False",
",",
"sentinel",
"=",
"None",
")",
":",
"# construct the args",
"args",
"=",
"list",
"(",
"args",
")",
"for",
"a",
"in",
"self",
".",
"_AXIS... | Construct and returns axes if supplied in args/kwargs.
If require_all, raise if all axis arguments are not supplied
return a tuple of (axes, kwargs).
sentinel specifies the default parameter when an axis is not
supplied; useful to distinguish when a user explicitly passes None
... | [
"Construct",
"and",
"returns",
"axes",
"if",
"supplied",
"in",
"args",
"/",
"kwargs",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L294-L332 | train |
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 | train |
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 | train |
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 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.transpose | def transpose(self, *args, **kwargs):
"""
Permute the dimensions of the %(klass)s
Parameters
----------
args : %(args_transpose)s
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
... | python | def transpose(self, *args, **kwargs):
"""
Permute the dimensions of the %(klass)s
Parameters
----------
args : %(args_transpose)s
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
... | [
"def",
"transpose",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# construct the args",
"axes",
",",
"kwargs",
"=",
"self",
".",
"_construct_axes_from_arguments",
"(",
"args",
",",
"kwargs",
",",
"require_all",
"=",
"True",
")",
"axes... | Permute the dimensions of the %(klass)s
Parameters
----------
args : %(args_transpose)s
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
**kwargs
Additional keyword arguments will ... | [
"Permute",
"the",
"dimensions",
"of",
"the",
"%",
"(",
"klass",
")",
"s"
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L650-L692 | train |
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 | train |
pandas-dev/pandas | pandas/core/generic.py | NDFrame.droplevel | def droplevel(self, level, axis=0):
"""
Return DataFrame with requested index / column level(s) removed.
.. versionadded:: 0.24.0
Parameters
----------
level : int, str, or list-like
If a string is given, must be the name of a level
If list-like,... | python | def droplevel(self, level, axis=0):
"""
Return DataFrame with requested index / column level(s) removed.
.. versionadded:: 0.24.0
Parameters
----------
level : int, str, or list-like
If a string is given, must be the name of a level
If list-like,... | [
"def",
"droplevel",
"(",
"self",
",",
"level",
",",
"axis",
"=",
"0",
")",
":",
"labels",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
")",
"new_labels",
"=",
"labels",
".",
"droplevel",
"(",
"level",
")",
"result",
"=",
"self",
".",
"set_axis",
"(",
... | Return DataFrame with requested index / column level(s) removed.
.. versionadded:: 0.24.0
Parameters
----------
level : int, str, or list-like
If a string is given, must be the name of a level
If list-like, elements must be names or positional indexes
... | [
"Return",
"DataFrame",
"with",
"requested",
"index",
"/",
"column",
"level",
"(",
"s",
")",
"removed",
"."
] | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L720-L777 | train |
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 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.