partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_maybe_convert_usecols
Convert `usecols` into a compatible format for parsing in `parsers.py`. Parameters ---------- usecols : object The use-columns object to potentially convert. Returns ------- converted : object The compatible format of `usecols`.
pandas/io/excel/_util.py
def _maybe_convert_usecols(usecols): """ Convert `usecols` into a compatible format for parsing in `parsers.py`. Parameters ---------- usecols : object The use-columns object to potentially convert. Returns ------- converted : object The compatible format of `usecols`. ...
def _maybe_convert_usecols(usecols): """ Convert `usecols` into a compatible format for parsing in `parsers.py`. Parameters ---------- usecols : object The use-columns object to potentially convert. Returns ------- converted : object The compatible format of `usecols`. ...
[ "Convert", "usecols", "into", "a", "compatible", "format", "for", "parsing", "in", "parsers", ".", "py", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L122-L149
[ "def", "_maybe_convert_usecols", "(", "usecols", ")", ":", "if", "usecols", "is", "None", ":", "return", "usecols", "if", "is_integer", "(", "usecols", ")", ":", "warnings", ".", "warn", "(", "(", "\"Passing in an integer for `usecols` has been \"", "\"deprecated. P...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_fill_mi_header
Forward fill blank entries in row but only inside the same parent index. Used for creating headers in Multiindex. Parameters ---------- row : list List of items in a single row. control_row : list of bool Helps to determine if particular column is in same parent index as the ...
pandas/io/excel/_util.py
def _fill_mi_header(row, control_row): """Forward fill blank entries in row but only inside the same parent index. Used for creating headers in Multiindex. Parameters ---------- row : list List of items in a single row. control_row : list of bool Helps to determine if particular...
def _fill_mi_header(row, control_row): """Forward fill blank entries in row but only inside the same parent index. Used for creating headers in Multiindex. Parameters ---------- row : list List of items in a single row. control_row : list of bool Helps to determine if particular...
[ "Forward", "fill", "blank", "entries", "in", "row", "but", "only", "inside", "the", "same", "parent", "index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L176-L204
[ "def", "_fill_mi_header", "(", "row", ",", "control_row", ")", ":", "last", "=", "row", "[", "0", "]", "for", "i", "in", "range", "(", "1", ",", "len", "(", "row", ")", ")", ":", "if", "not", "control_row", "[", "i", "]", ":", "last", "=", "row...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_pop_header_name
Pop the header name for MultiIndex parsing. Parameters ---------- row : list The data row to parse for the header name. index_col : int, list The index columns for our data. Assumed to be non-null. Returns ------- header_name : str The extracted header name. tri...
pandas/io/excel/_util.py
def _pop_header_name(row, index_col): """ Pop the header name for MultiIndex parsing. Parameters ---------- row : list The data row to parse for the header name. index_col : int, list The index columns for our data. Assumed to be non-null. Returns ------- header_nam...
def _pop_header_name(row, index_col): """ Pop the header name for MultiIndex parsing. Parameters ---------- row : list The data row to parse for the header name. index_col : int, list The index columns for our data. Assumed to be non-null. Returns ------- header_nam...
[ "Pop", "the", "header", "name", "for", "MultiIndex", "parsing", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_util.py#L207-L231
[ "def", "_pop_header_name", "(", "row", ",", "index_col", ")", ":", "# Pop out header name and fill w/blank.", "i", "=", "index_col", "if", "not", "is_list_like", "(", "index_col", ")", "else", "max", "(", "index_col", ")", "header_name", "=", "row", "[", "i", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_ensure_scope
Ensure that we are grabbing the correct scope.
pandas/core/computation/scope.py
def _ensure_scope(level, global_dict=None, local_dict=None, resolvers=(), target=None, **kwargs): """Ensure that we are grabbing the correct scope.""" return Scope(level + 1, global_dict=global_dict, local_dict=local_dict, resolvers=resolvers, target=target)
def _ensure_scope(level, global_dict=None, local_dict=None, resolvers=(), target=None, **kwargs): """Ensure that we are grabbing the correct scope.""" return Scope(level + 1, global_dict=global_dict, local_dict=local_dict, resolvers=resolvers, target=target)
[ "Ensure", "that", "we", "are", "grabbing", "the", "correct", "scope", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L22-L26
[ "def", "_ensure_scope", "(", "level", ",", "global_dict", "=", "None", ",", "local_dict", "=", "None", ",", "resolvers", "=", "(", ")", ",", "target", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "Scope", "(", "level", "+", "1", ",", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_replacer
Replace a number with its hexadecimal representation. Used to tag temporary variables with their calling scope's id.
pandas/core/computation/scope.py
def _replacer(x): """Replace a number with its hexadecimal representation. Used to tag temporary variables with their calling scope's id. """ # get the hex repr of the binary char and remove 0x and pad by pad_size # zeros try: hexin = ord(x) except TypeError: # bytes literals...
def _replacer(x): """Replace a number with its hexadecimal representation. Used to tag temporary variables with their calling scope's id. """ # get the hex repr of the binary char and remove 0x and pad by pad_size # zeros try: hexin = ord(x) except TypeError: # bytes literals...
[ "Replace", "a", "number", "with", "its", "hexadecimal", "representation", ".", "Used", "to", "tag", "temporary", "variables", "with", "their", "calling", "scope", "s", "id", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L29-L41
[ "def", "_replacer", "(", "x", ")", ":", "# get the hex repr of the binary char and remove 0x and pad by pad_size", "# zeros", "try", ":", "hexin", "=", "ord", "(", "x", ")", "except", "TypeError", ":", "# bytes literals masquerade as ints when iterating in py3", "hexin", "=...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_raw_hex_id
Return the padded hexadecimal id of ``obj``.
pandas/core/computation/scope.py
def _raw_hex_id(obj): """Return the padded hexadecimal id of ``obj``.""" # interpret as a pointer since that's what really what id returns packed = struct.pack('@P', id(obj)) return ''.join(map(_replacer, packed))
def _raw_hex_id(obj): """Return the padded hexadecimal id of ``obj``.""" # interpret as a pointer since that's what really what id returns packed = struct.pack('@P', id(obj)) return ''.join(map(_replacer, packed))
[ "Return", "the", "padded", "hexadecimal", "id", "of", "obj", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L44-L48
[ "def", "_raw_hex_id", "(", "obj", ")", ":", "# interpret as a pointer since that's what really what id returns", "packed", "=", "struct", ".", "pack", "(", "'@P'", ",", "id", "(", "obj", ")", ")", "return", "''", ".", "join", "(", "map", "(", "_replacer", ",",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_pretty_string
Return a prettier version of obj Parameters ---------- obj : object Object to pretty print Returns ------- s : str Pretty print object repr
pandas/core/computation/scope.py
def _get_pretty_string(obj): """Return a prettier version of obj Parameters ---------- obj : object Object to pretty print Returns ------- s : str Pretty print object repr """ sio = StringIO() pprint.pprint(obj, stream=sio) return sio.getvalue()
def _get_pretty_string(obj): """Return a prettier version of obj Parameters ---------- obj : object Object to pretty print Returns ------- s : str Pretty print object repr """ sio = StringIO() pprint.pprint(obj, stream=sio) return sio.getvalue()
[ "Return", "a", "prettier", "version", "of", "obj" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L63-L78
[ "def", "_get_pretty_string", "(", "obj", ")", ":", "sio", "=", "StringIO", "(", ")", "pprint", ".", "pprint", "(", "obj", ",", "stream", "=", "sio", ")", "return", "sio", ".", "getvalue", "(", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Scope.resolve
Resolve a variable name in a possibly local context Parameters ---------- key : str A variable name is_local : bool Flag indicating whether the variable is local or not (prefixed with the '@' symbol) Returns ------- value : ob...
pandas/core/computation/scope.py
def resolve(self, key, is_local): """Resolve a variable name in a possibly local context Parameters ---------- key : str A variable name is_local : bool Flag indicating whether the variable is local or not (prefixed with the '@' symbol) ...
def resolve(self, key, is_local): """Resolve a variable name in a possibly local context Parameters ---------- key : str A variable name is_local : bool Flag indicating whether the variable is local or not (prefixed with the '@' symbol) ...
[ "Resolve", "a", "variable", "name", "in", "a", "possibly", "local", "context" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L159-L195
[ "def", "resolve", "(", "self", ",", "key", ",", "is_local", ")", ":", "try", ":", "# only look for locals in outer scope", "if", "is_local", ":", "return", "self", ".", "scope", "[", "key", "]", "# not a local variable so check in resolvers if we have them", "if", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Scope.swapkey
Replace a variable name, with a potentially new value. Parameters ---------- old_key : str Current variable name to replace new_key : str New variable name to replace `old_key` with new_value : object Value to be replaced along with the possib...
pandas/core/computation/scope.py
def swapkey(self, old_key, new_key, new_value=None): """Replace a variable name, with a potentially new value. Parameters ---------- old_key : str Current variable name to replace new_key : str New variable name to replace `old_key` with new_value...
def swapkey(self, old_key, new_key, new_value=None): """Replace a variable name, with a potentially new value. Parameters ---------- old_key : str Current variable name to replace new_key : str New variable name to replace `old_key` with new_value...
[ "Replace", "a", "variable", "name", "with", "a", "potentially", "new", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L197-L219
[ "def", "swapkey", "(", "self", ",", "old_key", ",", "new_key", ",", "new_value", "=", "None", ")", ":", "if", "self", ".", "has_resolvers", ":", "maps", "=", "self", ".", "resolvers", ".", "maps", "+", "self", ".", "scope", ".", "maps", "else", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Scope._get_vars
Get specifically scoped variables from a list of stack frames. Parameters ---------- stack : list A list of stack frames as returned by ``inspect.stack()`` scopes : sequence of strings A sequence containing valid stack frame attribute names that evalu...
pandas/core/computation/scope.py
def _get_vars(self, stack, scopes): """Get specifically scoped variables from a list of stack frames. Parameters ---------- stack : list A list of stack frames as returned by ``inspect.stack()`` scopes : sequence of strings A sequence containing valid sta...
def _get_vars(self, stack, scopes): """Get specifically scoped variables from a list of stack frames. Parameters ---------- stack : list A list of stack frames as returned by ``inspect.stack()`` scopes : sequence of strings A sequence containing valid sta...
[ "Get", "specifically", "scoped", "variables", "from", "a", "list", "of", "stack", "frames", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L221-L241
[ "def", "_get_vars", "(", "self", ",", "stack", ",", "scopes", ")", ":", "variables", "=", "itertools", ".", "product", "(", "scopes", ",", "stack", ")", "for", "scope", ",", "(", "frame", ",", "_", ",", "_", ",", "_", ",", "_", ",", "_", ")", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Scope.update
Update the current scope by going back `level` levels. Parameters ---------- level : int or None, optional, default None
pandas/core/computation/scope.py
def update(self, level): """Update the current scope by going back `level` levels. Parameters ---------- level : int or None, optional, default None """ sl = level + 1 # add sl frames to the scope starting with the # most distant and overwriting with mor...
def update(self, level): """Update the current scope by going back `level` levels. Parameters ---------- level : int or None, optional, default None """ sl = level + 1 # add sl frames to the scope starting with the # most distant and overwriting with mor...
[ "Update", "the", "current", "scope", "by", "going", "back", "level", "levels", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L243-L260
[ "def", "update", "(", "self", ",", "level", ")", ":", "sl", "=", "level", "+", "1", "# add sl frames to the scope starting with the", "# most distant and overwriting with more current", "# makes sure that we can capture variable scope", "stack", "=", "inspect", ".", "stack", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Scope.add_tmp
Add a temporary variable to the scope. Parameters ---------- value : object An arbitrary object to be assigned to a temporary variable. Returns ------- name : basestring The name of the temporary variable created.
pandas/core/computation/scope.py
def add_tmp(self, value): """Add a temporary variable to the scope. Parameters ---------- value : object An arbitrary object to be assigned to a temporary variable. Returns ------- name : basestring The name of the temporary variable crea...
def add_tmp(self, value): """Add a temporary variable to the scope. Parameters ---------- value : object An arbitrary object to be assigned to a temporary variable. Returns ------- name : basestring The name of the temporary variable crea...
[ "Add", "a", "temporary", "variable", "to", "the", "scope", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L262-L285
[ "def", "add_tmp", "(", "self", ",", "value", ")", ":", "name", "=", "'{name}_{num}_{hex_id}'", ".", "format", "(", "name", "=", "type", "(", "value", ")", ".", "__name__", ",", "num", "=", "self", ".", "ntemps", ",", "hex_id", "=", "_raw_hex_id", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Scope.full_scope
Return the full scope for use with passing to engines transparently as a mapping. Returns ------- vars : DeepChainMap All variables in this scope.
pandas/core/computation/scope.py
def full_scope(self): """Return the full scope for use with passing to engines transparently as a mapping. Returns ------- vars : DeepChainMap All variables in this scope. """ maps = [self.temps] + self.resolvers.maps + self.scope.maps return ...
def full_scope(self): """Return the full scope for use with passing to engines transparently as a mapping. Returns ------- vars : DeepChainMap All variables in this scope. """ maps = [self.temps] + self.resolvers.maps + self.scope.maps return ...
[ "Return", "the", "full", "scope", "for", "use", "with", "passing", "to", "engines", "transparently", "as", "a", "mapping", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/scope.py#L293-L303
[ "def", "full_scope", "(", "self", ")", ":", "maps", "=", "[", "self", ".", "temps", "]", "+", "self", ".", "resolvers", ".", "maps", "+", "self", ".", "scope", ".", "maps", "return", "DeepChainMap", "(", "*", "maps", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
read_sas
Read SAS files stored as either XPORT or SAS7BDAT format files. Parameters ---------- filepath_or_buffer : string or file-like object Path to the SAS file. format : string {'xport', 'sas7bdat'} or None If None, file format is inferred from file extension. If 'xport' or 'sas7bdat...
pandas/io/sas/sasreader.py
def read_sas(filepath_or_buffer, format=None, index=None, encoding=None, chunksize=None, iterator=False): """ Read SAS files stored as either XPORT or SAS7BDAT format files. Parameters ---------- filepath_or_buffer : string or file-like object Path to the SAS file. format :...
def read_sas(filepath_or_buffer, format=None, index=None, encoding=None, chunksize=None, iterator=False): """ Read SAS files stored as either XPORT or SAS7BDAT format files. Parameters ---------- filepath_or_buffer : string or file-like object Path to the SAS file. format :...
[ "Read", "SAS", "files", "stored", "as", "either", "XPORT", "or", "SAS7BDAT", "format", "files", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/sas/sasreader.py#L7-L66
[ "def", "read_sas", "(", "filepath_or_buffer", ",", "format", "=", "None", ",", "index", "=", "None", ",", "encoding", "=", "None", ",", "chunksize", "=", "None", ",", "iterator", "=", "False", ")", ":", "if", "format", "is", "None", ":", "buffer_error_ms...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_coerce_method
Install the scalar coercion methods.
pandas/core/series.py
def _coerce_method(converter): """ Install the scalar coercion methods. """ def wrapper(self): if len(self) == 1: return converter(self.iloc[0]) raise TypeError("cannot convert the series to " "{0}".format(str(converter))) wrapper.__name__ = "__{...
def _coerce_method(converter): """ Install the scalar coercion methods. """ def wrapper(self): if len(self) == 1: return converter(self.iloc[0]) raise TypeError("cannot convert the series to " "{0}".format(str(converter))) wrapper.__name__ = "__{...
[ "Install", "the", "scalar", "coercion", "methods", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L80-L92
[ "def", "_coerce_method", "(", "converter", ")", ":", "def", "wrapper", "(", "self", ")", ":", "if", "len", "(", "self", ")", "==", "1", ":", "return", "converter", "(", "self", ".", "iloc", "[", "0", "]", ")", "raise", "TypeError", "(", "\"cannot con...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series._init_dict
Derive the "_data" and "index" attributes of a new Series from a dictionary input. Parameters ---------- data : dict or dict-like Data used to populate the new Series index : Index or index-like, default None index for the new Series: if None, use dict ke...
pandas/core/series.py
def _init_dict(self, data, index=None, dtype=None): """ Derive the "_data" and "index" attributes of a new Series from a dictionary input. Parameters ---------- data : dict or dict-like Data used to populate the new Series index : Index or index-like,...
def _init_dict(self, data, index=None, dtype=None): """ Derive the "_data" and "index" attributes of a new Series from a dictionary input. Parameters ---------- data : dict or dict-like Data used to populate the new Series index : Index or index-like,...
[ "Derive", "the", "_data", "and", "index", "attributes", "of", "a", "new", "Series", "from", "a", "dictionary", "input", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L267-L312
[ "def", "_init_dict", "(", "self", ",", "data", ",", "index", "=", "None", ",", "dtype", "=", "None", ")", ":", "# Looking for NaN in dict doesn't work ({np.nan : 1}[float('nan')]", "# raises KeyError), so we iterate the entire dict, and align", "if", "data", ":", "keys", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.from_array
Construct Series from array. .. deprecated :: 0.23.0 Use pd.Series(..) constructor instead.
pandas/core/series.py
def from_array(cls, arr, index=None, name=None, dtype=None, copy=False, fastpath=False): """ Construct Series from array. .. deprecated :: 0.23.0 Use pd.Series(..) constructor instead. """ warnings.warn("'from_array' is deprecated and will be remov...
def from_array(cls, arr, index=None, name=None, dtype=None, copy=False, fastpath=False): """ Construct Series from array. .. deprecated :: 0.23.0 Use pd.Series(..) constructor instead. """ warnings.warn("'from_array' is deprecated and will be remov...
[ "Construct", "Series", "from", "array", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L315-L330
[ "def", "from_array", "(", "cls", ",", "arr", ",", "index", "=", "None", ",", "name", "=", "None", ",", "dtype", "=", "None", ",", "copy", "=", "False", ",", "fastpath", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"'from_array' is deprecated...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series._set_axis
Override generic, we want to set the _typ here.
pandas/core/series.py
def _set_axis(self, axis, labels, fastpath=False): """ Override generic, we want to set the _typ here. """ if not fastpath: labels = ensure_index(labels) is_all_dates = labels.is_all_dates if is_all_dates: if not isinstance(labels, ...
def _set_axis(self, axis, labels, fastpath=False): """ Override generic, we want to set the _typ here. """ if not fastpath: labels = ensure_index(labels) is_all_dates = labels.is_all_dates if is_all_dates: if not isinstance(labels, ...
[ "Override", "generic", "we", "want", "to", "set", "the", "_typ", "here", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L350-L376
[ "def", "_set_axis", "(", "self", ",", "axis", ",", "labels", ",", "fastpath", "=", "False", ")", ":", "if", "not", "fastpath", ":", "labels", "=", "ensure_index", "(", "labels", ")", "is_all_dates", "=", "labels", ".", "is_all_dates", "if", "is_all_dates",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.asobject
Return object Series which contains boxed values. .. deprecated :: 0.23.0 Use ``astype(object)`` instead. *this is an internal non-public method*
pandas/core/series.py
def asobject(self): """ Return object Series which contains boxed values. .. deprecated :: 0.23.0 Use ``astype(object)`` instead. *this is an internal non-public method* """ warnings.warn("'asobject' is deprecated. Use 'astype(object)'" ...
def asobject(self): """ Return object Series which contains boxed values. .. deprecated :: 0.23.0 Use ``astype(object)`` instead. *this is an internal non-public method* """ warnings.warn("'asobject' is deprecated. Use 'astype(object)'" ...
[ "Return", "object", "Series", "which", "contains", "boxed", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L493-L505
[ "def", "asobject", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"'asobject' is deprecated. Use 'astype(object)'\"", "\" instead\"", ",", "FutureWarning", ",", "stacklevel", "=", "2", ")", "return", "self", ".", "astype", "(", "object", ")", ".", "value...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.compress
Return selected slices of an array along given axis as a Series. .. deprecated:: 0.24.0 See Also -------- numpy.ndarray.compress
pandas/core/series.py
def compress(self, condition, *args, **kwargs): """ Return selected slices of an array along given axis as a Series. .. deprecated:: 0.24.0 See Also -------- numpy.ndarray.compress """ msg = ("Series.compress(condition) is deprecated. " "U...
def compress(self, condition, *args, **kwargs): """ Return selected slices of an array along given axis as a Series. .. deprecated:: 0.24.0 See Also -------- numpy.ndarray.compress """ msg = ("Series.compress(condition) is deprecated. " "U...
[ "Return", "selected", "slices", "of", "an", "array", "along", "given", "axis", "as", "a", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L523-L538
[ "def", "compress", "(", "self", ",", "condition", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "msg", "=", "(", "\"Series.compress(condition) is deprecated. \"", "\"Use 'Series[condition]' or \"", "\"'np.asarray(series).compress(condition)' instead.\"", ")", "warn...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.nonzero
Return the *integer* indices of the elements that are non-zero. .. deprecated:: 0.24.0 Please use .to_numpy().nonzero() as a replacement. This method is equivalent to calling `numpy.nonzero` on the series data. For compatibility with NumPy, the return value is the same (a tu...
pandas/core/series.py
def nonzero(self): """ Return the *integer* indices of the elements that are non-zero. .. deprecated:: 0.24.0 Please use .to_numpy().nonzero() as a replacement. This method is equivalent to calling `numpy.nonzero` on the series data. For compatibility with NumPy, the...
def nonzero(self): """ Return the *integer* indices of the elements that are non-zero. .. deprecated:: 0.24.0 Please use .to_numpy().nonzero() as a replacement. This method is equivalent to calling `numpy.nonzero` on the series data. For compatibility with NumPy, the...
[ "Return", "the", "*", "integer", "*", "indices", "of", "the", "elements", "that", "are", "non", "-", "zero", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L540-L580
[ "def", "nonzero", "(", "self", ")", ":", "msg", "=", "(", "\"Series.nonzero() is deprecated \"", "\"and will be removed in a future version.\"", "\"Use Series.to_numpy().nonzero() instead\"", ")", "warnings", ".", "warn", "(", "msg", ",", "FutureWarning", ",", "stacklevel",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.view
Create a new view of the Series. This function will return a new Series with a view of the same underlying values in memory, optionally reinterpreted with a new data type. The new data type must preserve the same size in bytes as to not cause index misalignment. Parameters ...
pandas/core/series.py
def view(self, dtype=None): """ Create a new view of the Series. This function will return a new Series with a view of the same underlying values in memory, optionally reinterpreted with a new data type. The new data type must preserve the same size in bytes as to not ca...
def view(self, dtype=None): """ Create a new view of the Series. This function will return a new Series with a view of the same underlying values in memory, optionally reinterpreted with a new data type. The new data type must preserve the same size in bytes as to not ca...
[ "Create", "a", "new", "view", "of", "the", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L598-L665
[ "def", "view", "(", "self", ",", "dtype", "=", "None", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "_values", ".", "view", "(", "dtype", ")", ",", "index", "=", "self", ".", "index", ")", ".", "__finalize__", "(", "self", ")"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series._ixs
Return the i-th value or values in the Series by location. Parameters ---------- i : int, slice, or sequence of integers Returns ------- scalar (int) or Series (slice, sequence)
pandas/core/series.py
def _ixs(self, i, axis=0): """ Return the i-th value or values in the Series by location. Parameters ---------- i : int, slice, or sequence of integers Returns ------- scalar (int) or Series (slice, sequence) """ try: # dispa...
def _ixs(self, i, axis=0): """ Return the i-th value or values in the Series by location. Parameters ---------- i : int, slice, or sequence of integers Returns ------- scalar (int) or Series (slice, sequence) """ try: # dispa...
[ "Return", "the", "i", "-", "th", "value", "or", "values", "in", "the", "Series", "by", "location", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L824-L855
[ "def", "_ixs", "(", "self", ",", "i", ",", "axis", "=", "0", ")", ":", "try", ":", "# dispatch to the values if we need", "values", "=", "self", ".", "_values", "if", "isinstance", "(", "values", ",", "np", ".", "ndarray", ")", ":", "return", "libindex",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.repeat
Repeat elements of a Series. Returns a new Series where each element of the current Series is repeated consecutively a given number of times. Parameters ---------- repeats : int or array of ints The number of repetitions for each element. This should be a ...
pandas/core/series.py
def repeat(self, repeats, axis=None): """ Repeat elements of a Series. Returns a new Series where each element of the current Series is repeated consecutively a given number of times. Parameters ---------- repeats : int or array of ints The number of...
def repeat(self, repeats, axis=None): """ Repeat elements of a Series. Returns a new Series where each element of the current Series is repeated consecutively a given number of times. Parameters ---------- repeats : int or array of ints The number of...
[ "Repeat", "elements", "of", "a", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1105-L1161
[ "def", "repeat", "(", "self", ",", "repeats", ",", "axis", "=", "None", ")", ":", "nv", ".", "validate_repeat", "(", "tuple", "(", ")", ",", "dict", "(", "axis", "=", "axis", ")", ")", "new_index", "=", "self", ".", "index", ".", "repeat", "(", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.reset_index
Generate a new DataFrame or Series with the index reset. This is useful when the index needs to be treated as a column, or when the index is meaningless and needs to be reset to the default before another operation. Parameters ---------- level : int, str, tuple, or list...
pandas/core/series.py
def reset_index(self, level=None, drop=False, name=None, inplace=False): """ Generate a new DataFrame or Series with the index reset. This is useful when the index needs to be treated as a column, or when the index is meaningless and needs to be reset to the default before anoth...
def reset_index(self, level=None, drop=False, name=None, inplace=False): """ Generate a new DataFrame or Series with the index reset. This is useful when the index needs to be treated as a column, or when the index is meaningless and needs to be reset to the default before anoth...
[ "Generate", "a", "new", "DataFrame", "or", "Series", "with", "the", "index", "reset", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1235-L1365
[ "def", "reset_index", "(", "self", ",", "level", "=", "None", ",", "drop", "=", "False", ",", "name", "=", "None", ",", "inplace", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "if", "drop", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.to_string
Render a string representation of the Series. Parameters ---------- buf : StringIO-like, optional Buffer to write to. na_rep : str, optional String representation of NaN to use, default 'NaN'. float_format : one-parameter function, optional Fo...
pandas/core/series.py
def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True, index=True, length=False, dtype=False, name=False, max_rows=None): """ Render a string representation of the Series. Parameters ---------- buf : StringIO-like, optiona...
def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True, index=True, length=False, dtype=False, name=False, max_rows=None): """ Render a string representation of the Series. Parameters ---------- buf : StringIO-like, optiona...
[ "Render", "a", "string", "representation", "of", "the", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1386-L1441
[ "def", "to_string", "(", "self", ",", "buf", "=", "None", ",", "na_rep", "=", "'NaN'", ",", "float_format", "=", "None", ",", "header", "=", "True", ",", "index", "=", "True", ",", "length", "=", "False", ",", "dtype", "=", "False", ",", "name", "=...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.to_dict
Convert Series to {label -> value} dict or dict-like object. Parameters ---------- into : class, default dict The collections.abc.Mapping subclass to use as the return object. Can be the actual class or an empty instance of the mapping type you want. If you ...
pandas/core/series.py
def to_dict(self, into=dict): """ Convert Series to {label -> value} dict or dict-like object. Parameters ---------- into : class, default dict The collections.abc.Mapping subclass to use as the return object. Can be the actual class or an empty ...
def to_dict(self, into=dict): """ Convert Series to {label -> value} dict or dict-like object. Parameters ---------- into : class, default dict The collections.abc.Mapping subclass to use as the return object. Can be the actual class or an empty ...
[ "Convert", "Series", "to", "{", "label", "-", ">", "value", "}", "dict", "or", "dict", "-", "like", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1485-L1518
[ "def", "to_dict", "(", "self", ",", "into", "=", "dict", ")", ":", "# GH16122", "into_c", "=", "com", ".", "standardize_mapping", "(", "into", ")", "return", "into_c", "(", "self", ".", "items", "(", ")", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.to_frame
Convert Series to DataFrame. Parameters ---------- name : object, default None The passed name should substitute for the series name (if it has one). Returns ------- DataFrame DataFrame representation of Series. Examples ...
pandas/core/series.py
def to_frame(self, name=None): """ Convert Series to DataFrame. Parameters ---------- name : object, default None The passed name should substitute for the series name (if it has one). Returns ------- DataFrame DataFra...
def to_frame(self, name=None): """ Convert Series to DataFrame. Parameters ---------- name : object, default None The passed name should substitute for the series name (if it has one). Returns ------- DataFrame DataFra...
[ "Convert", "Series", "to", "DataFrame", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1520-L1550
[ "def", "to_frame", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "df", "=", "self", ".", "_constructor_expanddim", "(", "self", ")", "else", ":", "df", "=", "self", ".", "_constructor_expanddim", "(", "{", "name", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.to_sparse
Convert Series to SparseSeries. Parameters ---------- kind : {'block', 'integer'}, default 'block' fill_value : float, defaults to NaN (missing) Value to use for filling NaN values. Returns ------- SparseSeries Sparse representation of th...
pandas/core/series.py
def to_sparse(self, kind='block', fill_value=None): """ Convert Series to SparseSeries. Parameters ---------- kind : {'block', 'integer'}, default 'block' fill_value : float, defaults to NaN (missing) Value to use for filling NaN values. Returns ...
def to_sparse(self, kind='block', fill_value=None): """ Convert Series to SparseSeries. Parameters ---------- kind : {'block', 'integer'}, default 'block' fill_value : float, defaults to NaN (missing) Value to use for filling NaN values. Returns ...
[ "Convert", "Series", "to", "SparseSeries", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1552-L1573
[ "def", "to_sparse", "(", "self", ",", "kind", "=", "'block'", ",", "fill_value", "=", "None", ")", ":", "# TODO: deprecate", "from", "pandas", ".", "core", ".", "sparse", ".", "series", "import", "SparseSeries", "values", "=", "SparseArray", "(", "self", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series._set_name
Set the Series name. Parameters ---------- name : str inplace : bool whether to modify `self` directly or return a copy
pandas/core/series.py
def _set_name(self, name, inplace=False): """ Set the Series name. Parameters ---------- name : str inplace : bool whether to modify `self` directly or return a copy """ inplace = validate_bool_kwarg(inplace, 'inplace') ser = self if i...
def _set_name(self, name, inplace=False): """ Set the Series name. Parameters ---------- name : str inplace : bool whether to modify `self` directly or return a copy """ inplace = validate_bool_kwarg(inplace, 'inplace') ser = self if i...
[ "Set", "the", "Series", "name", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1575-L1588
[ "def", "_set_name", "(", "self", ",", "name", ",", "inplace", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "ser", "=", "self", "if", "inplace", "else", "self", ".", "copy", "(", ")", "ser", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.count
Return number of non-NA/null observations in the Series. Parameters ---------- level : int or level name, default None If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a smaller Series. Returns ------- i...
pandas/core/series.py
def count(self, level=None): """ Return number of non-NA/null observations in the Series. Parameters ---------- level : int or level name, default None If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a smaller S...
def count(self, level=None): """ Return number of non-NA/null observations in the Series. Parameters ---------- level : int or level name, default None If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a smaller S...
[ "Return", "number", "of", "non", "-", "NA", "/", "null", "observations", "in", "the", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1595-L1633
[ "def", "count", "(", "self", ",", "level", "=", "None", ")", ":", "if", "level", "is", "None", ":", "return", "notna", "(", "com", ".", "values_from_object", "(", "self", ")", ")", ".", "sum", "(", ")", "if", "isinstance", "(", "level", ",", "str",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.drop_duplicates
Return Series with duplicate values removed. Parameters ---------- keep : {'first', 'last', ``False``}, default 'first' - 'first' : Drop duplicates except for the first occurrence. - 'last' : Drop duplicates except for the last occurrence. - ``False`` : Drop ...
pandas/core/series.py
def drop_duplicates(self, keep='first', inplace=False): """ Return Series with duplicate values removed. Parameters ---------- keep : {'first', 'last', ``False``}, default 'first' - 'first' : Drop duplicates except for the first occurrence. - 'last' : Dro...
def drop_duplicates(self, keep='first', inplace=False): """ Return Series with duplicate values removed. Parameters ---------- keep : {'first', 'last', ``False``}, default 'first' - 'first' : Drop duplicates except for the first occurrence. - 'last' : Dro...
[ "Return", "Series", "with", "duplicate", "values", "removed", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1720-L1792
[ "def", "drop_duplicates", "(", "self", ",", "keep", "=", "'first'", ",", "inplace", "=", "False", ")", ":", "return", "super", "(", ")", ".", "drop_duplicates", "(", "keep", "=", "keep", ",", "inplace", "=", "inplace", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.idxmin
Return the row label of the minimum value. If multiple values equal the minimum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA/null values. If the entire Series is NA, the result will be NA....
pandas/core/series.py
def idxmin(self, axis=0, skipna=True, *args, **kwargs): """ Return the row label of the minimum value. If multiple values equal the minimum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA...
def idxmin(self, axis=0, skipna=True, *args, **kwargs): """ Return the row label of the minimum value. If multiple values equal the minimum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA...
[ "Return", "the", "row", "label", "of", "the", "minimum", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1870-L1938
[ "def", "idxmin", "(", "self", ",", "axis", "=", "0", ",", "skipna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "skipna", "=", "nv", ".", "validate_argmin_with_skipna", "(", "skipna", ",", "args", ",", "kwargs", ")", "i", "=",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.idxmax
Return the row label of the maximum value. If multiple values equal the maximum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA/null values. If the entire Series is NA, the result will be NA....
pandas/core/series.py
def idxmax(self, axis=0, skipna=True, *args, **kwargs): """ Return the row label of the maximum value. If multiple values equal the maximum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA...
def idxmax(self, axis=0, skipna=True, *args, **kwargs): """ Return the row label of the maximum value. If multiple values equal the maximum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA...
[ "Return", "the", "row", "label", "of", "the", "maximum", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1940-L2009
[ "def", "idxmax", "(", "self", ",", "axis", "=", "0", ",", "skipna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "skipna", "=", "nv", ".", "validate_argmax_with_skipna", "(", "skipna", ",", "args", ",", "kwargs", ")", "i", "=",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.round
Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Retu...
pandas/core/series.py
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of ...
def round(self, decimals=0, *args, **kwargs): """ Round each value in a Series to the given number of decimals. Parameters ---------- decimals : int Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of ...
[ "Round", "each", "value", "in", "a", "Series", "to", "the", "given", "number", "of", "decimals", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2033-L2067
[ "def", "round", "(", "self", ",", "decimals", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_round", "(", "args", ",", "kwargs", ")", "result", "=", "com", ".", "values_from_object", "(", "self", ")", ".", "roun...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.quantile
Return value at the given quantile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) 0 <= q <= 1, the quantile(s) to compute. interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} .. versionadded:: 0.18.0 This ...
pandas/core/series.py
def quantile(self, q=0.5, interpolation='linear'): """ Return value at the given quantile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) 0 <= q <= 1, the quantile(s) to compute. interpolation : {'linear', 'lower', 'higher', 'midpoi...
def quantile(self, q=0.5, interpolation='linear'): """ Return value at the given quantile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) 0 <= q <= 1, the quantile(s) to compute. interpolation : {'linear', 'lower', 'higher', 'midpoi...
[ "Return", "value", "at", "the", "given", "quantile", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2069-L2132
[ "def", "quantile", "(", "self", ",", "q", "=", "0.5", ",", "interpolation", "=", "'linear'", ")", ":", "self", ".", "_check_percentile", "(", "q", ")", "# We dispatch to DataFrame so that core.internals only has to worry", "# about 2D cases.", "df", "=", "self", "....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.corr
Compute correlation with `other` Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the correlation. method : {'pearson', 'kendall', 'spearman'} or callable * pearson : standard correlation coefficient ...
pandas/core/series.py
def corr(self, other, method='pearson', min_periods=None): """ Compute correlation with `other` Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the correlation. method : {'pearson', 'kendall', 'spearman'} or...
def corr(self, other, method='pearson', min_periods=None): """ Compute correlation with `other` Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the correlation. method : {'pearson', 'kendall', 'spearman'} or...
[ "Compute", "correlation", "with", "other", "Series", "excluding", "missing", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2134-L2180
[ "def", "corr", "(", "self", ",", "other", ",", "method", "=", "'pearson'", ",", "min_periods", "=", "None", ")", ":", "this", ",", "other", "=", "self", ".", "align", "(", "other", ",", "join", "=", "'inner'", ",", "copy", "=", "False", ")", "if", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.cov
Compute covariance with Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the covariance. min_periods : int, optional Minimum number of observations needed to have a valid result. Returns ------- ...
pandas/core/series.py
def cov(self, other, min_periods=None): """ Compute covariance with Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the covariance. min_periods : int, optional Minimum number of observations need...
def cov(self, other, min_periods=None): """ Compute covariance with Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the covariance. min_periods : int, optional Minimum number of observations need...
[ "Compute", "covariance", "with", "Series", "excluding", "missing", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2182-L2210
[ "def", "cov", "(", "self", ",", "other", ",", "min_periods", "=", "None", ")", ":", "this", ",", "other", "=", "self", ".", "align", "(", "other", ",", "join", "=", "'inner'", ",", "copy", "=", "False", ")", "if", "len", "(", "this", ")", "==", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.diff
First discrete difference of element. Calculates the difference of a Series element compared with another element in the Series (default is element in previous row). Parameters ---------- periods : int, default 1 Periods to shift for calculating difference, accepts ...
pandas/core/series.py
def diff(self, periods=1): """ First discrete difference of element. Calculates the difference of a Series element compared with another element in the Series (default is element in previous row). Parameters ---------- periods : int, default 1 Period...
def diff(self, periods=1): """ First discrete difference of element. Calculates the difference of a Series element compared with another element in the Series (default is element in previous row). Parameters ---------- periods : int, default 1 Period...
[ "First", "discrete", "difference", "of", "element", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2212-L2274
[ "def", "diff", "(", "self", ",", "periods", "=", "1", ")", ":", "result", "=", "algorithms", ".", "diff", "(", "com", ".", "values_from_object", "(", "self", ")", ",", "periods", ")", "return", "self", ".", "_constructor", "(", "result", ",", "index", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.dot
Compute the dot product between the Series and the columns of other. This method computes the dot product between the Series and another one, or the Series and each columns of a DataFrame, or the Series and each columns of an array. It can also be called using `self @ other` in Python ...
pandas/core/series.py
def dot(self, other): """ Compute the dot product between the Series and the columns of other. This method computes the dot product between the Series and another one, or the Series and each columns of a DataFrame, or the Series and each columns of an array. It can also...
def dot(self, other): """ Compute the dot product between the Series and the columns of other. This method computes the dot product between the Series and another one, or the Series and each columns of a DataFrame, or the Series and each columns of an array. It can also...
[ "Compute", "the", "dot", "product", "between", "the", "Series", "and", "the", "columns", "of", "other", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2321-L2397
[ "def", "dot", "(", "self", ",", "other", ")", ":", "from", "pandas", ".", "core", ".", "frame", "import", "DataFrame", "if", "isinstance", "(", "other", ",", "(", "Series", ",", "DataFrame", ")", ")", ":", "common", "=", "self", ".", "index", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.append
Concatenate two or more Series. Parameters ---------- to_append : Series or list/tuple of Series Series to append with self. ignore_index : bool, default False If True, do not use the index labels. .. versionadded:: 0.19.0 verify_integrity :...
pandas/core/series.py
def append(self, to_append, ignore_index=False, verify_integrity=False): """ Concatenate two or more Series. Parameters ---------- to_append : Series or list/tuple of Series Series to append with self. ignore_index : bool, default False If True, d...
def append(self, to_append, ignore_index=False, verify_integrity=False): """ Concatenate two or more Series. Parameters ---------- to_append : Series or list/tuple of Series Series to append with self. ignore_index : bool, default False If True, d...
[ "Concatenate", "two", "or", "more", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2420-L2501
[ "def", "append", "(", "self", ",", "to_append", ",", "ignore_index", "=", "False", ",", "verify_integrity", "=", "False", ")", ":", "from", "pandas", ".", "core", ".", "reshape", ".", "concat", "import", "concat", "if", "isinstance", "(", "to_append", ",",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series._binop
Perform generic binary operation with optional fill value. Parameters ---------- other : Series func : binary operator fill_value : float or object Value to substitute for NA/null values. If both Series are NA in a location, the result will be NA regardle...
pandas/core/series.py
def _binop(self, other, func, level=None, fill_value=None): """ Perform generic binary operation with optional fill value. Parameters ---------- other : Series func : binary operator fill_value : float or object Value to substitute for NA/null values....
def _binop(self, other, func, level=None, fill_value=None): """ Perform generic binary operation with optional fill value. Parameters ---------- other : Series func : binary operator fill_value : float or object Value to substitute for NA/null values....
[ "Perform", "generic", "binary", "operation", "with", "optional", "fill", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2503-L2545
[ "def", "_binop", "(", "self", ",", "other", ",", "func", ",", "level", "=", "None", ",", "fill_value", "=", "None", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Series", ")", ":", "raise", "AssertionError", "(", "'Other operand must be Series'"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.combine
Combine the Series with a Series or scalar according to `func`. Combine the Series and `other` using `func` to perform elementwise selection for combined Series. `fill_value` is assumed when value is missing at some index from one of the two objects being combined. Parameters ...
pandas/core/series.py
def combine(self, other, func, fill_value=None): """ Combine the Series with a Series or scalar according to `func`. Combine the Series and `other` using `func` to perform elementwise selection for combined Series. `fill_value` is assumed when value is missing at some index ...
def combine(self, other, func, fill_value=None): """ Combine the Series with a Series or scalar according to `func`. Combine the Series and `other` using `func` to perform elementwise selection for combined Series. `fill_value` is assumed when value is missing at some index ...
[ "Combine", "the", "Series", "with", "a", "Series", "or", "scalar", "according", "to", "func", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2547-L2650
[ "def", "combine", "(", "self", ",", "other", ",", "func", ",", "fill_value", "=", "None", ")", ":", "if", "fill_value", "is", "None", ":", "fill_value", "=", "na_value_for_dtype", "(", "self", ".", "dtype", ",", "compat", "=", "False", ")", "if", "isin...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.combine_first
Combine Series values, choosing the calling Series's values first. Parameters ---------- other : Series The value(s) to be combined with the `Series`. Returns ------- Series The result of combining the Series with the other object. See A...
pandas/core/series.py
def combine_first(self, other): """ Combine Series values, choosing the calling Series's values first. Parameters ---------- other : Series The value(s) to be combined with the `Series`. Returns ------- Series The result of combin...
def combine_first(self, other): """ Combine Series values, choosing the calling Series's values first. Parameters ---------- other : Series The value(s) to be combined with the `Series`. Returns ------- Series The result of combin...
[ "Combine", "Series", "values", "choosing", "the", "calling", "Series", "s", "values", "first", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2652-L2690
[ "def", "combine_first", "(", "self", ",", "other", ")", ":", "new_index", "=", "self", ".", "index", ".", "union", "(", "other", ".", "index", ")", "this", "=", "self", ".", "reindex", "(", "new_index", ",", "copy", "=", "False", ")", "other", "=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.update
Modify Series in place using non-NA values from passed Series. Aligns on index. Parameters ---------- other : Series Examples -------- >>> s = pd.Series([1, 2, 3]) >>> s.update(pd.Series([4, 5, 6])) >>> s 0 4 1 5 2 ...
pandas/core/series.py
def update(self, other): """ Modify Series in place using non-NA values from passed Series. Aligns on index. Parameters ---------- other : Series Examples -------- >>> s = pd.Series([1, 2, 3]) >>> s.update(pd.Series([4, 5, 6])) >>...
def update(self, other): """ Modify Series in place using non-NA values from passed Series. Aligns on index. Parameters ---------- other : Series Examples -------- >>> s = pd.Series([1, 2, 3]) >>> s.update(pd.Series([4, 5, 6])) >>...
[ "Modify", "Series", "in", "place", "using", "non", "-", "NA", "values", "from", "passed", "Series", ".", "Aligns", "on", "index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2692-L2742
[ "def", "update", "(", "self", ",", "other", ")", ":", "other", "=", "other", ".", "reindex_like", "(", "self", ")", "mask", "=", "notna", "(", "other", ")", "self", ".", "_data", "=", "self", ".", "_data", ".", "putmask", "(", "mask", "=", "mask", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.sort_values
Sort by the values. Sort a Series in ascending or descending order by some criterion. Parameters ---------- axis : {0 or 'index'}, default 0 Axis to direct sorting. The value 'index' is accepted for compatibility with DataFrame.sort_values. ascen...
pandas/core/series.py
def sort_values(self, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'): """ Sort by the values. Sort a Series in ascending or descending order by some criterion. Parameters ---------- axis : {0 or 'index'}, default...
def sort_values(self, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'): """ Sort by the values. Sort a Series in ascending or descending order by some criterion. Parameters ---------- axis : {0 or 'index'}, default...
[ "Sort", "by", "the", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2747-L2910
[ "def", "sort_values", "(", "self", ",", "axis", "=", "0", ",", "ascending", "=", "True", ",", "inplace", "=", "False", ",", "kind", "=", "'quicksort'", ",", "na_position", "=", "'last'", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.sort_index
Sort Series by index labels. Returns a new Series sorted by label if `inplace` argument is ``False``, otherwise updates the original series and returns None. Parameters ---------- axis : int, default 0 Axis to direct sorting. This can only be 0 for Series. l...
pandas/core/series.py
def sort_index(self, axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True): """ Sort Series by index labels. Returns a new Series sorted by label if `inplace` argument is ``False``, otherwise updates the original...
def sort_index(self, axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True): """ Sort Series by index labels. Returns a new Series sorted by label if `inplace` argument is ``False``, otherwise updates the original...
[ "Sort", "Series", "by", "index", "labels", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2912-L3065
[ "def", "sort_index", "(", "self", ",", "axis", "=", "0", ",", "level", "=", "None", ",", "ascending", "=", "True", ",", "inplace", "=", "False", ",", "kind", "=", "'quicksort'", ",", "na_position", "=", "'last'", ",", "sort_remaining", "=", "True", ")"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.argsort
Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. Parameters ---------- axis : int Has no effect but is accepted for compatibility with numpy. kind : {'mergesort', 'quicksort', 'he...
pandas/core/series.py
def argsort(self, axis=0, kind='quicksort', order=None): """ Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. Parameters ---------- axis : int Has no effect but is accepte...
def argsort(self, axis=0, kind='quicksort', order=None): """ Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. Parameters ---------- axis : int Has no effect but is accepte...
[ "Override", "ndarray", ".", "argsort", ".", "Argsorts", "the", "value", "omitting", "NA", "/", "null", "values", "and", "places", "the", "result", "in", "the", "same", "locations", "as", "the", "non", "-", "NA", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3067-L3105
[ "def", "argsort", "(", "self", ",", "axis", "=", "0", ",", "kind", "=", "'quicksort'", ",", "order", "=", "None", ")", ":", "values", "=", "self", ".", "_values", "mask", "=", "isna", "(", "values", ")", "if", "mask", ".", "any", "(", ")", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.nlargest
Return the largest `n` elements. Parameters ---------- n : int, default 5 Return this many descending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that cannot all fit in a Series of `n` elements: ...
pandas/core/series.py
def nlargest(self, n=5, keep='first'): """ Return the largest `n` elements. Parameters ---------- n : int, default 5 Return this many descending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that c...
def nlargest(self, n=5, keep='first'): """ Return the largest `n` elements. Parameters ---------- n : int, default 5 Return this many descending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that c...
[ "Return", "the", "largest", "n", "elements", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3107-L3203
[ "def", "nlargest", "(", "self", ",", "n", "=", "5", ",", "keep", "=", "'first'", ")", ":", "return", "algorithms", ".", "SelectNSeries", "(", "self", ",", "n", "=", "n", ",", "keep", "=", "keep", ")", ".", "nlargest", "(", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.nsmallest
Return the smallest `n` elements. Parameters ---------- n : int, default 5 Return this many ascending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that cannot all fit in a Series of `n` elements: ...
pandas/core/series.py
def nsmallest(self, n=5, keep='first'): """ Return the smallest `n` elements. Parameters ---------- n : int, default 5 Return this many ascending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that ...
def nsmallest(self, n=5, keep='first'): """ Return the smallest `n` elements. Parameters ---------- n : int, default 5 Return this many ascending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that ...
[ "Return", "the", "smallest", "n", "elements", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3205-L3300
[ "def", "nsmallest", "(", "self", ",", "n", "=", "5", ",", "keep", "=", "'first'", ")", ":", "return", "algorithms", ".", "SelectNSeries", "(", "self", ",", "n", "=", "n", ",", "keep", "=", "keep", ")", ".", "nsmallest", "(", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.swaplevel
Swap levels i and j in a MultiIndex. Parameters ---------- i, j : int, str (can be mixed) Level of index to be swapped. Can pass level name as string. Returns ------- Series Series with levels swapped in MultiIndex. .. versionchanged:: 0...
pandas/core/series.py
def swaplevel(self, i=-2, j=-1, copy=True): """ Swap levels i and j in a MultiIndex. Parameters ---------- i, j : int, str (can be mixed) Level of index to be swapped. Can pass level name as string. Returns ------- Series Series w...
def swaplevel(self, i=-2, j=-1, copy=True): """ Swap levels i and j in a MultiIndex. Parameters ---------- i, j : int, str (can be mixed) Level of index to be swapped. Can pass level name as string. Returns ------- Series Series w...
[ "Swap", "levels", "i", "and", "j", "in", "a", "MultiIndex", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3302-L3323
[ "def", "swaplevel", "(", "self", ",", "i", "=", "-", "2", ",", "j", "=", "-", "1", ",", "copy", "=", "True", ")", ":", "new_index", "=", "self", ".", "index", ".", "swaplevel", "(", "i", ",", "j", ")", "return", "self", ".", "_constructor", "("...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.reorder_levels
Rearrange index levels using input order. May not drop or duplicate levels. Parameters ---------- order : list of int representing new level order (reference level by number or key) Returns ------- type of caller (new object)
pandas/core/series.py
def reorder_levels(self, order): """ Rearrange index levels using input order. May not drop or duplicate levels. Parameters ---------- order : list of int representing new level order (reference level by number or key) Returns ------- ...
def reorder_levels(self, order): """ Rearrange index levels using input order. May not drop or duplicate levels. Parameters ---------- order : list of int representing new level order (reference level by number or key) Returns ------- ...
[ "Rearrange", "index", "levels", "using", "input", "order", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3325-L3345
[ "def", "reorder_levels", "(", "self", ",", "order", ")", ":", "if", "not", "isinstance", "(", "self", ".", "index", ",", "MultiIndex", ")", ":", "# pragma: no cover", "raise", "Exception", "(", "'Can only reorder levels on a hierarchical axis.'", ")", "result", "=...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.map
Map values of Series according to input correspondence. Used for substituting each value in a Series with another value, that may be derived from a function, a ``dict`` or a :class:`Series`. Parameters ---------- arg : function, dict, or Series Mapping corre...
pandas/core/series.py
def map(self, arg, na_action=None): """ Map values of Series according to input correspondence. Used for substituting each value in a Series with another value, that may be derived from a function, a ``dict`` or a :class:`Series`. Parameters ---------- a...
def map(self, arg, na_action=None): """ Map values of Series according to input correspondence. Used for substituting each value in a Series with another value, that may be derived from a function, a ``dict`` or a :class:`Series`. Parameters ---------- a...
[ "Map", "values", "of", "Series", "according", "to", "input", "correspondence", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3394-L3472
[ "def", "map", "(", "self", ",", "arg", ",", "na_action", "=", "None", ")", ":", "new_values", "=", "super", "(", ")", ".", "_map_values", "(", "arg", ",", "na_action", "=", "na_action", ")", "return", "self", ".", "_constructor", "(", "new_values", ","...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.apply
Invoke function on values of Series. Can be ufunc (a NumPy function that applies to the entire Series) or a Python function that only works on single values. Parameters ---------- func : function Python function or NumPy ufunc to apply. convert_dtype : bool,...
pandas/core/series.py
def apply(self, func, convert_dtype=True, args=(), **kwds): """ Invoke function on values of Series. Can be ufunc (a NumPy function that applies to the entire Series) or a Python function that only works on single values. Parameters ---------- func : function ...
def apply(self, func, convert_dtype=True, args=(), **kwds): """ Invoke function on values of Series. Can be ufunc (a NumPy function that applies to the entire Series) or a Python function that only works on single values. Parameters ---------- func : function ...
[ "Invoke", "function", "on", "values", "of", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3554-L3686
[ "def", "apply", "(", "self", ",", "func", ",", "convert_dtype", "=", "True", ",", "args", "=", "(", ")", ",", "*", "*", "kwds", ")", ":", "if", "len", "(", "self", ")", "==", "0", ":", "return", "self", ".", "_constructor", "(", "dtype", "=", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series._reduce
Perform a reduction operation. If we have an ndarray as a value, then simply perform the operation, otherwise delegate to the object.
pandas/core/series.py
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds): """ Perform a reduction operation. If we have an ndarray as a value, then simply perform the operation, otherwise delegate to the object. """ delegate = self._v...
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds): """ Perform a reduction operation. If we have an ndarray as a value, then simply perform the operation, otherwise delegate to the object. """ delegate = self._v...
[ "Perform", "a", "reduction", "operation", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3688-L3725
[ "def", "_reduce", "(", "self", ",", "op", ",", "name", ",", "axis", "=", "0", ",", "skipna", "=", "True", ",", "numeric_only", "=", "None", ",", "filter_type", "=", "None", ",", "*", "*", "kwds", ")", ":", "delegate", "=", "self", ".", "_values", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.rename
Alter Series index labels or name. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. Alternatively, change ``Series.name`` with a scalar value. See the :ref:`user guide <basics....
pandas/core/series.py
def rename(self, index=None, **kwargs): """ Alter Series index labels or name. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. Alternatively, change ``Series.name`` wit...
def rename(self, index=None, **kwargs): """ Alter Series index labels or name. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. Alternatively, change ``Series.name`` wit...
[ "Alter", "Series", "index", "labels", "or", "name", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3753-L3821
[ "def", "rename", "(", "self", ",", "index", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'inplace'", "]", "=", "validate_bool_kwarg", "(", "kwargs", ".", "get", "(", "'inplace'", ",", "False", ")", ",", "'inplace'", ")", "non_mapping...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.reindex_axis
Conform Series to new index with optional filling logic. .. deprecated:: 0.21.0 Use ``Series.reindex`` instead.
pandas/core/series.py
def reindex_axis(self, labels, axis=0, **kwargs): """ Conform Series to new index with optional filling logic. .. deprecated:: 0.21.0 Use ``Series.reindex`` instead. """ # for compatibility with higher dims if axis != 0: raise ValueError("cannot r...
def reindex_axis(self, labels, axis=0, **kwargs): """ Conform Series to new index with optional filling logic. .. deprecated:: 0.21.0 Use ``Series.reindex`` instead. """ # for compatibility with higher dims if axis != 0: raise ValueError("cannot r...
[ "Conform", "Series", "to", "new", "index", "with", "optional", "filling", "logic", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3940-L3954
[ "def", "reindex_axis", "(", "self", ",", "labels", ",", "axis", "=", "0", ",", "*", "*", "kwargs", ")", ":", "# for compatibility with higher dims", "if", "axis", "!=", "0", ":", "raise", "ValueError", "(", "\"cannot reindex series on non-zero axis!\"", ")", "ms...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.memory_usage
Return the memory usage of the Series. The memory usage can optionally include the contribution of the index and of elements of `object` dtype. Parameters ---------- index : bool, default True Specifies whether to include the memory usage of the Series index. ...
pandas/core/series.py
def memory_usage(self, index=True, deep=False): """ Return the memory usage of the Series. The memory usage can optionally include the contribution of the index and of elements of `object` dtype. Parameters ---------- index : bool, default True Speci...
def memory_usage(self, index=True, deep=False): """ Return the memory usage of the Series. The memory usage can optionally include the contribution of the index and of elements of `object` dtype. Parameters ---------- index : bool, default True Speci...
[ "Return", "the", "memory", "usage", "of", "the", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L3956-L4008
[ "def", "memory_usage", "(", "self", ",", "index", "=", "True", ",", "deep", "=", "False", ")", ":", "v", "=", "super", "(", ")", ".", "memory_usage", "(", "deep", "=", "deep", ")", "if", "index", ":", "v", "+=", "self", ".", "index", ".", "memory...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.isin
Check whether `values` are contained in Series. Return a boolean Series showing whether each element in the Series matches an element in the passed sequence of `values` exactly. Parameters ---------- values : set or list-like The sequence of values to test. Passing ...
pandas/core/series.py
def isin(self, values): """ Check whether `values` are contained in Series. Return a boolean Series showing whether each element in the Series matches an element in the passed sequence of `values` exactly. Parameters ---------- values : set or list-like ...
def isin(self, values): """ Check whether `values` are contained in Series. Return a boolean Series showing whether each element in the Series matches an element in the passed sequence of `values` exactly. Parameters ---------- values : set or list-like ...
[ "Check", "whether", "values", "are", "contained", "in", "Series", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4035-L4093
[ "def", "isin", "(", "self", ",", "values", ")", ":", "result", "=", "algorithms", ".", "isin", "(", "self", ",", "values", ")", "return", "self", ".", "_constructor", "(", "result", ",", "index", "=", "self", ".", "index", ")", ".", "__finalize__", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.between
Return boolean Series equivalent to left <= series <= right. This function returns a boolean vector containing `True` wherever the corresponding Series element is between the boundary values `left` and `right`. NA values are treated as `False`. Parameters ---------- lef...
pandas/core/series.py
def between(self, left, right, inclusive=True): """ Return boolean Series equivalent to left <= series <= right. This function returns a boolean vector containing `True` wherever the corresponding Series element is between the boundary values `left` and `right`. NA values are tr...
def between(self, left, right, inclusive=True): """ Return boolean Series equivalent to left <= series <= right. This function returns a boolean vector containing `True` wherever the corresponding Series element is between the boundary values `left` and `right`. NA values are tr...
[ "Return", "boolean", "Series", "equivalent", "to", "left", "<", "=", "series", "<", "=", "right", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4095-L4168
[ "def", "between", "(", "self", ",", "left", ",", "right", ",", "inclusive", "=", "True", ")", ":", "if", "inclusive", ":", "lmask", "=", "self", ">=", "left", "rmask", "=", "self", "<=", "right", "else", ":", "lmask", "=", "self", ">", "left", "rma...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.from_csv
Read CSV file. .. deprecated:: 0.21.0 Use :func:`pandas.read_csv` instead. It is preferable to use the more powerful :func:`pandas.read_csv` for most general purposes, but ``from_csv`` makes for an easy roundtrip to and from a file (the exact counterpart of ``to_csv...
pandas/core/series.py
def from_csv(cls, path, sep=',', parse_dates=True, header=None, index_col=0, encoding=None, infer_datetime_format=False): """ Read CSV file. .. deprecated:: 0.21.0 Use :func:`pandas.read_csv` instead. It is preferable to use the more powerful :func:`pandas....
def from_csv(cls, path, sep=',', parse_dates=True, header=None, index_col=0, encoding=None, infer_datetime_format=False): """ Read CSV file. .. deprecated:: 0.21.0 Use :func:`pandas.read_csv` instead. It is preferable to use the more powerful :func:`pandas....
[ "Read", "CSV", "file", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4171-L4236
[ "def", "from_csv", "(", "cls", ",", "path", ",", "sep", "=", "','", ",", "parse_dates", "=", "True", ",", "header", "=", "None", ",", "index_col", "=", "0", ",", "encoding", "=", "None", ",", "infer_datetime_format", "=", "False", ")", ":", "# We're ca...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.dropna
Return a new Series with missing values removed. See the :ref:`User Guide <missing_data>` for more on which values are considered missing, and how to work with missing data. Parameters ---------- axis : {0 or 'index'}, default 0 There is only one axis to drop values...
pandas/core/series.py
def dropna(self, axis=0, inplace=False, **kwargs): """ Return a new Series with missing values removed. See the :ref:`User Guide <missing_data>` for more on which values are considered missing, and how to work with missing data. Parameters ---------- axis : {0 o...
def dropna(self, axis=0, inplace=False, **kwargs): """ Return a new Series with missing values removed. See the :ref:`User Guide <missing_data>` for more on which values are considered missing, and how to work with missing data. Parameters ---------- axis : {0 o...
[ "Return", "a", "new", "Series", "with", "missing", "values", "removed", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4311-L4401
[ "def", "dropna", "(", "self", ",", "axis", "=", "0", ",", "inplace", "=", "False", ",", "*", "*", "kwargs", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "kwargs", ".", "pop", "(", "'how'", ",", "None", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.valid
Return Series without null values. .. deprecated:: 0.23.0 Use :meth:`Series.dropna` instead.
pandas/core/series.py
def valid(self, inplace=False, **kwargs): """ Return Series without null values. .. deprecated:: 0.23.0 Use :meth:`Series.dropna` instead. """ warnings.warn("Method .valid will be removed in a future version. " "Use .dropna instead.", FutureWarn...
def valid(self, inplace=False, **kwargs): """ Return Series without null values. .. deprecated:: 0.23.0 Use :meth:`Series.dropna` instead. """ warnings.warn("Method .valid will be removed in a future version. " "Use .dropna instead.", FutureWarn...
[ "Return", "Series", "without", "null", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4403-L4412
[ "def", "valid", "(", "self", ",", "inplace", "=", "False", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"Method .valid will be removed in a future version. \"", "\"Use .dropna instead.\"", ",", "FutureWarning", ",", "stacklevel", "=", "2", ")...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.to_timestamp
Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Convention for converting period to timestamp; start of period vs. en...
pandas/core/series.py
def to_timestamp(self, freq=None, how='start', copy=True): """ Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Co...
def to_timestamp(self, freq=None, how='start', copy=True): """ Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Co...
[ "Cast", "to", "DatetimeIndex", "of", "Timestamps", "at", "*", "beginning", "*", "of", "period", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4417-L4441
[ "def", "to_timestamp", "(", "self", ",", "freq", "=", "None", ",", "how", "=", "'start'", ",", "copy", "=", "True", ")", ":", "new_values", "=", "self", ".", "_values", "if", "copy", ":", "new_values", "=", "new_values", ".", "copy", "(", ")", "new_i...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Series.to_period
Convert Series from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed). Parameters ---------- freq : str, default None Frequency associated with the PeriodIndex. copy : bool, default True Whether or not to return a cop...
pandas/core/series.py
def to_period(self, freq=None, copy=True): """ Convert Series from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed). Parameters ---------- freq : str, default None Frequency associated with the PeriodIndex. copy ...
def to_period(self, freq=None, copy=True): """ Convert Series from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed). Parameters ---------- freq : str, default None Frequency associated with the PeriodIndex. copy ...
[ "Convert", "Series", "from", "DatetimeIndex", "to", "PeriodIndex", "with", "desired", "frequency", "(", "inferred", "from", "index", "if", "not", "passed", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4443-L4466
[ "def", "to_period", "(", "self", ",", "freq", "=", "None", ",", "copy", "=", "True", ")", ":", "new_values", "=", "self", ".", "_values", "if", "copy", ":", "new_values", "=", "new_values", ".", "copy", "(", ")", "new_index", "=", "self", ".", "index...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
to_numeric
Convert argument to a numeric type. The default return dtype is `float64` or `int64` depending on the data supplied. Use the `downcast` parameter to obtain other dtypes. Please note that precision loss may occur if really large numbers are passed in. Due to the internal limitations of `ndarray`, i...
pandas/core/tools/numeric.py
def to_numeric(arg, errors='raise', downcast=None): """ Convert argument to a numeric type. The default return dtype is `float64` or `int64` depending on the data supplied. Use the `downcast` parameter to obtain other dtypes. Please note that precision loss may occur if really large numbers ...
def to_numeric(arg, errors='raise', downcast=None): """ Convert argument to a numeric type. The default return dtype is `float64` or `int64` depending on the data supplied. Use the `downcast` parameter to obtain other dtypes. Please note that precision loss may occur if really large numbers ...
[ "Convert", "argument", "to", "a", "numeric", "type", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/tools/numeric.py#L14-L187
[ "def", "to_numeric", "(", "arg", ",", "errors", "=", "'raise'", ",", "downcast", "=", "None", ")", ":", "if", "downcast", "not", "in", "(", "None", ",", "'integer'", ",", "'signed'", ",", "'unsigned'", ",", "'float'", ")", ":", "raise", "ValueError", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_fill
Create a 0-dim ndarray containing the fill value Parameters ---------- arr : SparseArray Returns ------- fill_value : ndarray 0-dim ndarray with just the fill value. Notes ----- coerce fill_value to arr dtype if possible int64 SparseArray can have NaN as fill_value if ...
pandas/core/arrays/sparse.py
def _get_fill(arr: ABCSparseArray) -> np.ndarray: """ Create a 0-dim ndarray containing the fill value Parameters ---------- arr : SparseArray Returns ------- fill_value : ndarray 0-dim ndarray with just the fill value. Notes ----- coerce fill_value to arr dtype if...
def _get_fill(arr: ABCSparseArray) -> np.ndarray: """ Create a 0-dim ndarray containing the fill value Parameters ---------- arr : SparseArray Returns ------- fill_value : ndarray 0-dim ndarray with just the fill value. Notes ----- coerce fill_value to arr dtype if...
[ "Create", "a", "0", "-", "dim", "ndarray", "containing", "the", "fill", "value" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L386-L407
[ "def", "_get_fill", "(", "arr", ":", "ABCSparseArray", ")", "->", "np", ".", "ndarray", ":", "try", ":", "return", "np", ".", "asarray", "(", "arr", ".", "fill_value", ",", "dtype", "=", "arr", ".", "dtype", ".", "subtype", ")", "except", "ValueError",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_sparse_array_op
Perform a binary operation between two arrays. Parameters ---------- left : Union[SparseArray, ndarray] right : Union[SparseArray, ndarray] op : Callable The binary operation to perform name str Name of the callable. Returns ------- SparseArray
pandas/core/arrays/sparse.py
def _sparse_array_op( left: ABCSparseArray, right: ABCSparseArray, op: Callable, name: str ) -> Any: """ Perform a binary operation between two arrays. Parameters ---------- left : Union[SparseArray, ndarray] right : Union[SparseArray, ndarray] op : Callable ...
def _sparse_array_op( left: ABCSparseArray, right: ABCSparseArray, op: Callable, name: str ) -> Any: """ Perform a binary operation between two arrays. Parameters ---------- left : Union[SparseArray, ndarray] right : Union[SparseArray, ndarray] op : Callable ...
[ "Perform", "a", "binary", "operation", "between", "two", "arrays", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L410-L495
[ "def", "_sparse_array_op", "(", "left", ":", "ABCSparseArray", ",", "right", ":", "ABCSparseArray", ",", "op", ":", "Callable", ",", "name", ":", "str", ")", "->", "Any", ":", "if", "name", ".", "startswith", "(", "'__'", ")", ":", "# For lookups in _libs....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_wrap_result
wrap op result to have correct dtype
pandas/core/arrays/sparse.py
def _wrap_result(name, data, sparse_index, fill_value, dtype=None): """ wrap op result to have correct dtype """ if name.startswith('__'): # e.g. __eq__ --> eq name = name[2:-2] if name in ('eq', 'ne', 'lt', 'gt', 'le', 'ge'): dtype = np.bool fill_value = lib.item_from_...
def _wrap_result(name, data, sparse_index, fill_value, dtype=None): """ wrap op result to have correct dtype """ if name.startswith('__'): # e.g. __eq__ --> eq name = name[2:-2] if name in ('eq', 'ne', 'lt', 'gt', 'le', 'ge'): dtype = np.bool fill_value = lib.item_from_...
[ "wrap", "op", "result", "to", "have", "correct", "dtype" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L498-L517
[ "def", "_wrap_result", "(", "name", ",", "data", ",", "sparse_index", ",", "fill_value", ",", "dtype", "=", "None", ")", ":", "if", "name", ".", "startswith", "(", "'__'", ")", ":", "# e.g. __eq__ --> eq", "name", "=", "name", "[", "2", ":", "-", "2", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_maybe_to_sparse
array must be SparseSeries or SparseArray
pandas/core/arrays/sparse.py
def _maybe_to_sparse(array): """ array must be SparseSeries or SparseArray """ if isinstance(array, ABCSparseSeries): array = array.values.copy() return array
def _maybe_to_sparse(array): """ array must be SparseSeries or SparseArray """ if isinstance(array, ABCSparseSeries): array = array.values.copy() return array
[ "array", "must", "be", "SparseSeries", "or", "SparseArray" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1803-L1809
[ "def", "_maybe_to_sparse", "(", "array", ")", ":", "if", "isinstance", "(", "array", ",", "ABCSparseSeries", ")", ":", "array", "=", "array", ".", "values", ".", "copy", "(", ")", "return", "array" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_sanitize_values
return an ndarray for our input, in a platform independent manner
pandas/core/arrays/sparse.py
def _sanitize_values(arr): """ return an ndarray for our input, in a platform independent manner """ if hasattr(arr, 'values'): arr = arr.values else: # scalar if is_scalar(arr): arr = [arr] # ndarray if isinstance(arr, np.ndarray): ...
def _sanitize_values(arr): """ return an ndarray for our input, in a platform independent manner """ if hasattr(arr, 'values'): arr = arr.values else: # scalar if is_scalar(arr): arr = [arr] # ndarray if isinstance(arr, np.ndarray): ...
[ "return", "an", "ndarray", "for", "our", "input", "in", "a", "platform", "independent", "manner" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1812-L1836
[ "def", "_sanitize_values", "(", "arr", ")", ":", "if", "hasattr", "(", "arr", ",", "'values'", ")", ":", "arr", "=", "arr", ".", "values", "else", ":", "# scalar", "if", "is_scalar", "(", "arr", ")", ":", "arr", "=", "[", "arr", "]", "# ndarray", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
make_sparse
Convert ndarray to sparse format Parameters ---------- arr : ndarray kind : {'block', 'integer'} fill_value : NaN or another value dtype : np.dtype, optional copy : bool, default False Returns ------- (sparse_values, index, fill_value) : (ndarray, SparseIndex, Scalar)
pandas/core/arrays/sparse.py
def make_sparse(arr, kind='block', fill_value=None, dtype=None, copy=False): """ Convert ndarray to sparse format Parameters ---------- arr : ndarray kind : {'block', 'integer'} fill_value : NaN or another value dtype : np.dtype, optional copy : bool, default False Returns ...
def make_sparse(arr, kind='block', fill_value=None, dtype=None, copy=False): """ Convert ndarray to sparse format Parameters ---------- arr : ndarray kind : {'block', 'integer'} fill_value : NaN or another value dtype : np.dtype, optional copy : bool, default False Returns ...
[ "Convert", "ndarray", "to", "sparse", "format" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1839-L1891
[ "def", "make_sparse", "(", "arr", ",", "kind", "=", "'block'", ",", "fill_value", "=", "None", ",", "dtype", "=", "None", ",", "copy", "=", "False", ")", ":", "arr", "=", "_sanitize_values", "(", "arr", ")", "if", "arr", ".", "ndim", ">", "1", ":",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.density
The percent of non- ``fill_value`` points, as decimal. Examples -------- >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) >>> s.density 0.6
pandas/core/arrays/sparse.py
def density(self): """ The percent of non- ``fill_value`` points, as decimal. Examples -------- >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) >>> s.density 0.6 """ r = float(self.sp_index.npoints) / float(self.sp_index.length) return ...
def density(self): """ The percent of non- ``fill_value`` points, as decimal. Examples -------- >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) >>> s.density 0.6 """ r = float(self.sp_index.npoints) / float(self.sp_index.length) return ...
[ "The", "percent", "of", "non", "-", "fill_value", "points", "as", "decimal", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L814-L825
[ "def", "density", "(", "self", ")", ":", "r", "=", "float", "(", "self", ".", "sp_index", ".", "npoints", ")", "/", "float", "(", "self", ".", "sp_index", ".", "length", ")", "return", "r" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.fillna
Fill missing values with `value`. Parameters ---------- value : scalar, optional method : str, optional .. warning:: Using 'method' will result in high memory use, as all `fill_value` methods will be converted to an in-memory nd...
pandas/core/arrays/sparse.py
def fillna(self, value=None, method=None, limit=None): """ Fill missing values with `value`. Parameters ---------- value : scalar, optional method : str, optional .. warning:: Using 'method' will result in high memory use, as a...
def fillna(self, value=None, method=None, limit=None): """ Fill missing values with `value`. Parameters ---------- value : scalar, optional method : str, optional .. warning:: Using 'method' will result in high memory use, as a...
[ "Fill", "missing", "values", "with", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L855-L908
[ "def", "fillna", "(", "self", ",", "value", "=", "None", ",", "method", "=", "None", ",", "limit", "=", "None", ")", ":", "if", "(", "(", "method", "is", "None", "and", "value", "is", "None", ")", "or", "(", "method", "is", "not", "None", "and", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray._first_fill_value_loc
Get the location of the first missing value. Returns ------- int
pandas/core/arrays/sparse.py
def _first_fill_value_loc(self): """ Get the location of the first missing value. Returns ------- int """ if len(self) == 0 or self.sp_index.npoints == len(self): return -1 indices = self.sp_index.to_int_index().indices if not len(ind...
def _first_fill_value_loc(self): """ Get the location of the first missing value. Returns ------- int """ if len(self) == 0 or self.sp_index.npoints == len(self): return -1 indices = self.sp_index.to_int_index().indices if not len(ind...
[ "Get", "the", "location", "of", "the", "first", "missing", "value", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L939-L955
[ "def", "_first_fill_value_loc", "(", "self", ")", ":", "if", "len", "(", "self", ")", "==", "0", "or", "self", ".", "sp_index", ".", "npoints", "==", "len", "(", "self", ")", ":", "return", "-", "1", "indices", "=", "self", ".", "sp_index", ".", "t...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.value_counts
Returns a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaN, even if NaN is in sp_values. Returns ------- counts : Series
pandas/core/arrays/sparse.py
def value_counts(self, dropna=True): """ Returns a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaN, even if NaN is in sp_values. Returns ------- counts : Series ...
def value_counts(self, dropna=True): """ Returns a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaN, even if NaN is in sp_values. Returns ------- counts : Series ...
[ "Returns", "a", "Series", "containing", "counts", "of", "unique", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L979-L1015
[ "def", "value_counts", "(", "self", ",", "dropna", "=", "True", ")", ":", "from", "pandas", "import", "Index", ",", "Series", "keys", ",", "counts", "=", "algos", ".", "_value_counts_arraylike", "(", "self", ".", "sp_values", ",", "dropna", "=", "dropna", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.astype
Change the dtype of a SparseArray. The output will always be a SparseArray. To convert to a dense ndarray with a certain dtype, use :meth:`numpy.asarray`. Parameters ---------- dtype : np.dtype or ExtensionDtype For SparseDtype, this changes the dtype of ...
pandas/core/arrays/sparse.py
def astype(self, dtype=None, copy=True): """ Change the dtype of a SparseArray. The output will always be a SparseArray. To convert to a dense ndarray with a certain dtype, use :meth:`numpy.asarray`. Parameters ---------- dtype : np.dtype or ExtensionDtype ...
def astype(self, dtype=None, copy=True): """ Change the dtype of a SparseArray. The output will always be a SparseArray. To convert to a dense ndarray with a certain dtype, use :meth:`numpy.asarray`. Parameters ---------- dtype : np.dtype or ExtensionDtype ...
[ "Change", "the", "dtype", "of", "a", "SparseArray", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1278-L1345
[ "def", "astype", "(", "self", ",", "dtype", "=", "None", ",", "copy", "=", "True", ")", ":", "dtype", "=", "self", ".", "dtype", ".", "update_dtype", "(", "dtype", ")", "subtype", "=", "dtype", ".", "_subtype_with_str", "sp_values", "=", "astype_nansafe"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.map
Map categories using input correspondence (dict, Series, or function). Parameters ---------- mapper : dict, Series, callable The correspondence from old values to new. Returns ------- SparseArray The output array will have the same density as the...
pandas/core/arrays/sparse.py
def map(self, mapper): """ Map categories using input correspondence (dict, Series, or function). Parameters ---------- mapper : dict, Series, callable The correspondence from old values to new. Returns ------- SparseArray The out...
def map(self, mapper): """ Map categories using input correspondence (dict, Series, or function). Parameters ---------- mapper : dict, Series, callable The correspondence from old values to new. Returns ------- SparseArray The out...
[ "Map", "categories", "using", "input", "correspondence", "(", "dict", "Series", "or", "function", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1347-L1398
[ "def", "map", "(", "self", ",", "mapper", ")", ":", "# this is used in apply.", "# We get hit since we're an \"is_extension_type\" but regular extension", "# types are not hit. This may be worth adding to the interface.", "if", "isinstance", "(", "mapper", ",", "ABCSeries", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.all
Tests whether all elements evaluate True Returns ------- all : bool See Also -------- numpy.all
pandas/core/arrays/sparse.py
def all(self, axis=None, *args, **kwargs): """ Tests whether all elements evaluate True Returns ------- all : bool See Also -------- numpy.all """ nv.validate_all(args, kwargs) values = self.sp_values if len(values) != l...
def all(self, axis=None, *args, **kwargs): """ Tests whether all elements evaluate True Returns ------- all : bool See Also -------- numpy.all """ nv.validate_all(args, kwargs) values = self.sp_values if len(values) != l...
[ "Tests", "whether", "all", "elements", "evaluate", "True" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1461-L1480
[ "def", "all", "(", "self", ",", "axis", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_all", "(", "args", ",", "kwargs", ")", "values", "=", "self", ".", "sp_values", "if", "len", "(", "values", ")", "!=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.any
Tests whether at least one of elements evaluate True Returns ------- any : bool See Also -------- numpy.any
pandas/core/arrays/sparse.py
def any(self, axis=0, *args, **kwargs): """ Tests whether at least one of elements evaluate True Returns ------- any : bool See Also -------- numpy.any """ nv.validate_any(args, kwargs) values = self.sp_values if len(val...
def any(self, axis=0, *args, **kwargs): """ Tests whether at least one of elements evaluate True Returns ------- any : bool See Also -------- numpy.any """ nv.validate_any(args, kwargs) values = self.sp_values if len(val...
[ "Tests", "whether", "at", "least", "one", "of", "elements", "evaluate", "True" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1482-L1501
[ "def", "any", "(", "self", ",", "axis", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_any", "(", "args", ",", "kwargs", ")", "values", "=", "self", ".", "sp_values", "if", "len", "(", "values", ")", "!=", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.sum
Sum of non-NA/null values Returns ------- sum : float
pandas/core/arrays/sparse.py
def sum(self, axis=0, *args, **kwargs): """ Sum of non-NA/null values Returns ------- sum : float """ nv.validate_sum(args, kwargs) valid_vals = self._valid_sp_values sp_sum = valid_vals.sum() if self._null_fill_value: return s...
def sum(self, axis=0, *args, **kwargs): """ Sum of non-NA/null values Returns ------- sum : float """ nv.validate_sum(args, kwargs) valid_vals = self._valid_sp_values sp_sum = valid_vals.sum() if self._null_fill_value: return s...
[ "Sum", "of", "non", "-", "NA", "/", "null", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1503-L1518
[ "def", "sum", "(", "self", ",", "axis", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_sum", "(", "args", ",", "kwargs", ")", "valid_vals", "=", "self", ".", "_valid_sp_values", "sp_sum", "=", "valid_vals", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.cumsum
Cumulative sum of non-NA/null values. When performing the cumulative summation, any non-NA/null values will be skipped. The resulting SparseArray will preserve the locations of NaN values, but the fill value will be `np.nan` regardless. Parameters ---------- axis : int ...
pandas/core/arrays/sparse.py
def cumsum(self, axis=0, *args, **kwargs): """ Cumulative sum of non-NA/null values. When performing the cumulative summation, any non-NA/null values will be skipped. The resulting SparseArray will preserve the locations of NaN values, but the fill value will be `np.nan` regardl...
def cumsum(self, axis=0, *args, **kwargs): """ Cumulative sum of non-NA/null values. When performing the cumulative summation, any non-NA/null values will be skipped. The resulting SparseArray will preserve the locations of NaN values, but the fill value will be `np.nan` regardl...
[ "Cumulative", "sum", "of", "non", "-", "NA", "/", "null", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1520-L1547
[ "def", "cumsum", "(", "self", ",", "axis", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_cumsum", "(", "args", ",", "kwargs", ")", "if", "axis", "is", "not", "None", "and", "axis", ">=", "self", ".", "ndim", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SparseArray.mean
Mean of non-NA/null values Returns ------- mean : float
pandas/core/arrays/sparse.py
def mean(self, axis=0, *args, **kwargs): """ Mean of non-NA/null values Returns ------- mean : float """ nv.validate_mean(args, kwargs) valid_vals = self._valid_sp_values sp_sum = valid_vals.sum() ct = len(valid_vals) if self._nul...
def mean(self, axis=0, *args, **kwargs): """ Mean of non-NA/null values Returns ------- mean : float """ nv.validate_mean(args, kwargs) valid_vals = self._valid_sp_values sp_sum = valid_vals.sum() ct = len(valid_vals) if self._nul...
[ "Mean", "of", "non", "-", "NA", "/", "null", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L1549-L1566
[ "def", "mean", "(", "self", ",", "axis", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_mean", "(", "args", ",", "kwargs", ")", "valid_vals", "=", "self", ".", "_valid_sp_values", "sp_sum", "=", "valid_vals", ".",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
tokenize_string
Tokenize a Python source code string. Parameters ---------- source : str A Python source code string
pandas/core/computation/expr.py
def tokenize_string(source): """Tokenize a Python source code string. Parameters ---------- source : str A Python source code string """ line_reader = StringIO(source).readline token_generator = tokenize.generate_tokens(line_reader) # Loop over all tokens till a backtick (`) is...
def tokenize_string(source): """Tokenize a Python source code string. Parameters ---------- source : str A Python source code string """ line_reader = StringIO(source).readline token_generator = tokenize.generate_tokens(line_reader) # Loop over all tokens till a backtick (`) is...
[ "Tokenize", "a", "Python", "source", "code", "string", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L29-L49
[ "def", "tokenize_string", "(", "source", ")", ":", "line_reader", "=", "StringIO", "(", "source", ")", ".", "readline", "token_generator", "=", "tokenize", ".", "generate_tokens", "(", "line_reader", ")", "# Loop over all tokens till a backtick (`) is found.", "# Then, ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_replace_booleans
Replace ``&`` with ``and`` and ``|`` with ``or`` so that bitwise precedence is changed to boolean precedence. Parameters ---------- tok : tuple of int, str ints correspond to the all caps constants in the tokenize module Returns ------- t : tuple of int, str Either the inpu...
pandas/core/computation/expr.py
def _replace_booleans(tok): """Replace ``&`` with ``and`` and ``|`` with ``or`` so that bitwise precedence is changed to boolean precedence. Parameters ---------- tok : tuple of int, str ints correspond to the all caps constants in the tokenize module Returns ------- t : tuple ...
def _replace_booleans(tok): """Replace ``&`` with ``and`` and ``|`` with ``or`` so that bitwise precedence is changed to boolean precedence. Parameters ---------- tok : tuple of int, str ints correspond to the all caps constants in the tokenize module Returns ------- t : tuple ...
[ "Replace", "&", "with", "and", "and", "|", "with", "or", "so", "that", "bitwise", "precedence", "is", "changed", "to", "boolean", "precedence", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L70-L91
[ "def", "_replace_booleans", "(", "tok", ")", ":", "toknum", ",", "tokval", "=", "tok", "if", "toknum", "==", "tokenize", ".", "OP", ":", "if", "tokval", "==", "'&'", ":", "return", "tokenize", ".", "NAME", ",", "'and'", "elif", "tokval", "==", "'|'", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_replace_locals
Replace local variables with a syntactically valid name. Parameters ---------- tok : tuple of int, str ints correspond to the all caps constants in the tokenize module Returns ------- t : tuple of int, str Either the input or token or the replacement values Notes -----...
pandas/core/computation/expr.py
def _replace_locals(tok): """Replace local variables with a syntactically valid name. Parameters ---------- tok : tuple of int, str ints correspond to the all caps constants in the tokenize module Returns ------- t : tuple of int, str Either the input or token or the replac...
def _replace_locals(tok): """Replace local variables with a syntactically valid name. Parameters ---------- tok : tuple of int, str ints correspond to the all caps constants in the tokenize module Returns ------- t : tuple of int, str Either the input or token or the replac...
[ "Replace", "local", "variables", "with", "a", "syntactically", "valid", "name", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L94-L116
[ "def", "_replace_locals", "(", "tok", ")", ":", "toknum", ",", "tokval", "=", "tok", "if", "toknum", "==", "tokenize", ".", "OP", "and", "tokval", "==", "'@'", ":", "return", "tokenize", ".", "OP", ",", "_LOCAL_TAG", "return", "toknum", ",", "tokval" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_clean_spaces_backtick_quoted_names
Clean up a column name if surrounded by backticks. Backtick quoted string are indicated by a certain tokval value. If a string is a backtick quoted token it will processed by :func:`_remove_spaces_column_name` so that the parser can find this string when the query is executed. See also :meth:`NDFra...
pandas/core/computation/expr.py
def _clean_spaces_backtick_quoted_names(tok): """Clean up a column name if surrounded by backticks. Backtick quoted string are indicated by a certain tokval value. If a string is a backtick quoted token it will processed by :func:`_remove_spaces_column_name` so that the parser can find this string ...
def _clean_spaces_backtick_quoted_names(tok): """Clean up a column name if surrounded by backticks. Backtick quoted string are indicated by a certain tokval value. If a string is a backtick quoted token it will processed by :func:`_remove_spaces_column_name` so that the parser can find this string ...
[ "Clean", "up", "a", "column", "name", "if", "surrounded", "by", "backticks", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L119-L141
[ "def", "_clean_spaces_backtick_quoted_names", "(", "tok", ")", ":", "toknum", ",", "tokval", "=", "tok", "if", "toknum", "==", "_BACKTICK_QUOTED_STRING", ":", "return", "tokenize", ".", "NAME", ",", "_remove_spaces_column_name", "(", "tokval", ")", "return", "tokn...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_preparse
Compose a collection of tokenization functions Parameters ---------- source : str A Python source code string f : callable This takes a tuple of (toknum, tokval) as its argument and returns a tuple with the same structure but possibly different elements. Defaults to the ...
pandas/core/computation/expr.py
def _preparse(source, f=_compose(_replace_locals, _replace_booleans, _rewrite_assign, _clean_spaces_backtick_quoted_names)): """Compose a collection of tokenization functions Parameters ---------- source : str A Python source cod...
def _preparse(source, f=_compose(_replace_locals, _replace_booleans, _rewrite_assign, _clean_spaces_backtick_quoted_names)): """Compose a collection of tokenization functions Parameters ---------- source : str A Python source cod...
[ "Compose", "a", "collection", "of", "tokenization", "functions" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L155-L182
[ "def", "_preparse", "(", "source", ",", "f", "=", "_compose", "(", "_replace_locals", ",", "_replace_booleans", ",", "_rewrite_assign", ",", "_clean_spaces_backtick_quoted_names", ")", ")", ":", "assert", "callable", "(", "f", ")", ",", "'f must be callable'", "re...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_filter_nodes
Filter out AST nodes that are subclasses of ``superclass``.
pandas/core/computation/expr.py
def _filter_nodes(superclass, all_nodes=_all_nodes): """Filter out AST nodes that are subclasses of ``superclass``.""" node_names = (node.__name__ for node in all_nodes if issubclass(node, superclass)) return frozenset(node_names)
def _filter_nodes(superclass, all_nodes=_all_nodes): """Filter out AST nodes that are subclasses of ``superclass``.""" node_names = (node.__name__ for node in all_nodes if issubclass(node, superclass)) return frozenset(node_names)
[ "Filter", "out", "AST", "nodes", "that", "are", "subclasses", "of", "superclass", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L200-L204
[ "def", "_filter_nodes", "(", "superclass", ",", "all_nodes", "=", "_all_nodes", ")", ":", "node_names", "=", "(", "node", ".", "__name__", "for", "node", "in", "all_nodes", "if", "issubclass", "(", "node", ",", "superclass", ")", ")", "return", "frozenset", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_node_not_implemented
Return a function that raises a NotImplementedError with a passed node name.
pandas/core/computation/expr.py
def _node_not_implemented(node_name, cls): """Return a function that raises a NotImplementedError with a passed node name. """ def f(self, *args, **kwargs): raise NotImplementedError("{name!r} nodes are not " "implemented".format(name=node_name)) return f
def _node_not_implemented(node_name, cls): """Return a function that raises a NotImplementedError with a passed node name. """ def f(self, *args, **kwargs): raise NotImplementedError("{name!r} nodes are not " "implemented".format(name=node_name)) return f
[ "Return", "a", "function", "that", "raises", "a", "NotImplementedError", "with", "a", "passed", "node", "name", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L247-L255
[ "def", "_node_not_implemented", "(", "node_name", ",", "cls", ")", ":", "def", "f", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"{name!r} nodes are not \"", "\"implemented\"", ".", "format", "(", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
disallow
Decorator to disallow certain nodes from parsing. Raises a NotImplementedError instead. Returns ------- disallowed : callable
pandas/core/computation/expr.py
def disallow(nodes): """Decorator to disallow certain nodes from parsing. Raises a NotImplementedError instead. Returns ------- disallowed : callable """ def disallowed(cls): cls.unsupported_nodes = () for node in nodes: new_method = _node_not_implemented(node, c...
def disallow(nodes): """Decorator to disallow certain nodes from parsing. Raises a NotImplementedError instead. Returns ------- disallowed : callable """ def disallowed(cls): cls.unsupported_nodes = () for node in nodes: new_method = _node_not_implemented(node, c...
[ "Decorator", "to", "disallow", "certain", "nodes", "from", "parsing", ".", "Raises", "a", "NotImplementedError", "instead", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L258-L274
[ "def", "disallow", "(", "nodes", ")", ":", "def", "disallowed", "(", "cls", ")", ":", "cls", ".", "unsupported_nodes", "=", "(", ")", "for", "node", "in", "nodes", ":", "new_method", "=", "_node_not_implemented", "(", "node", ",", "cls", ")", "name", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_op_maker
Return a function to create an op class with its symbol already passed. Returns ------- f : callable
pandas/core/computation/expr.py
def _op_maker(op_class, op_symbol): """Return a function to create an op class with its symbol already passed. Returns ------- f : callable """ def f(self, node, *args, **kwargs): """Return a partial function with an Op subclass with an operator already passed. Returns...
def _op_maker(op_class, op_symbol): """Return a function to create an op class with its symbol already passed. Returns ------- f : callable """ def f(self, node, *args, **kwargs): """Return a partial function with an Op subclass with an operator already passed. Returns...
[ "Return", "a", "function", "to", "create", "an", "op", "class", "with", "its", "symbol", "already", "passed", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L277-L294
[ "def", "_op_maker", "(", "op_class", ",", "op_symbol", ")", ":", "def", "f", "(", "self", ",", "node", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Return a partial function with an Op subclass with an operator\n already passed.\n\n Returns\...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
add_ops
Decorator to add default implementation of ops.
pandas/core/computation/expr.py
def add_ops(op_classes): """Decorator to add default implementation of ops.""" def f(cls): for op_attr_name, op_class in op_classes.items(): ops = getattr(cls, '{name}_ops'.format(name=op_attr_name)) ops_map = getattr(cls, '{name}_op_nodes_map'.format( name=op_att...
def add_ops(op_classes): """Decorator to add default implementation of ops.""" def f(cls): for op_attr_name, op_class in op_classes.items(): ops = getattr(cls, '{name}_ops'.format(name=op_attr_name)) ops_map = getattr(cls, '{name}_op_nodes_map'.format( name=op_att...
[ "Decorator", "to", "add", "default", "implementation", "of", "ops", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L300-L313
[ "def", "add_ops", "(", "op_classes", ")", ":", "def", "f", "(", "cls", ")", ":", "for", "op_attr_name", ",", "op_class", "in", "op_classes", ".", "items", "(", ")", ":", "ops", "=", "getattr", "(", "cls", ",", "'{name}_ops'", ".", "format", "(", "nam...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Expr.names
Get the names in an expression
pandas/core/computation/expr.py
def names(self): """Get the names in an expression""" if is_term(self.terms): return frozenset([self.terms.name]) return frozenset(term.name for term in com.flatten(self.terms))
def names(self): """Get the names in an expression""" if is_term(self.terms): return frozenset([self.terms.name]) return frozenset(term.name for term in com.flatten(self.terms))
[ "Get", "the", "names", "in", "an", "expression" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expr.py#L749-L753
[ "def", "names", "(", "self", ")", ":", "if", "is_term", "(", "self", ".", "terms", ")", ":", "return", "frozenset", "(", "[", "self", ".", "terms", ".", "name", "]", ")", "return", "frozenset", "(", "term", ".", "name", "for", "term", "in", "com", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_is_convertible_to_index
return a boolean whether I can attempt conversion to a TimedeltaIndex
pandas/core/indexes/timedeltas.py
def _is_convertible_to_index(other): """ return a boolean whether I can attempt conversion to a TimedeltaIndex """ if isinstance(other, TimedeltaIndex): return True elif (len(other) > 0 and other.inferred_type not in ('floating', 'mixed-integer', 'integer', ...
def _is_convertible_to_index(other): """ return a boolean whether I can attempt conversion to a TimedeltaIndex """ if isinstance(other, TimedeltaIndex): return True elif (len(other) > 0 and other.inferred_type not in ('floating', 'mixed-integer', 'integer', ...
[ "return", "a", "boolean", "whether", "I", "can", "attempt", "conversion", "to", "a", "TimedeltaIndex" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/timedeltas.py#L719-L729
[ "def", "_is_convertible_to_index", "(", "other", ")", ":", "if", "isinstance", "(", "other", ",", "TimedeltaIndex", ")", ":", "return", "True", "elif", "(", "len", "(", "other", ")", ">", "0", "and", "other", ".", "inferred_type", "not", "in", "(", "'flo...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
timedelta_range
Return a fixed frequency TimedeltaIndex, with day as the default frequency Parameters ---------- start : string or timedelta-like, default None Left bound for generating timedeltas end : string or timedelta-like, default None Right bound for generating timedeltas periods : integ...
pandas/core/indexes/timedeltas.py
def timedelta_range(start=None, end=None, periods=None, freq=None, name=None, closed=None): """ Return a fixed frequency TimedeltaIndex, with day as the default frequency Parameters ---------- start : string or timedelta-like, default None Left bound for generating t...
def timedelta_range(start=None, end=None, periods=None, freq=None, name=None, closed=None): """ Return a fixed frequency TimedeltaIndex, with day as the default frequency Parameters ---------- start : string or timedelta-like, default None Left bound for generating t...
[ "Return", "a", "fixed", "frequency", "TimedeltaIndex", "with", "day", "as", "the", "default", "frequency" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/timedeltas.py#L732-L805
[ "def", "timedelta_range", "(", "start", "=", "None", ",", "end", "=", "None", ",", "periods", "=", "None", ",", "freq", "=", "None", ",", "name", "=", "None", ",", "closed", "=", "None", ")", ":", "if", "freq", "is", "None", "and", "com", ".", "_...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FrozenList.union
Returns a FrozenList with other concatenated to the end of self. Parameters ---------- other : array-like The array-like whose elements we are concatenating. Returns ------- diff : FrozenList The collection difference between self and other.
pandas/core/indexes/frozen.py
def union(self, other): """ Returns a FrozenList with other concatenated to the end of self. Parameters ---------- other : array-like The array-like whose elements we are concatenating. Returns ------- diff : FrozenList The collec...
def union(self, other): """ Returns a FrozenList with other concatenated to the end of self. Parameters ---------- other : array-like The array-like whose elements we are concatenating. Returns ------- diff : FrozenList The collec...
[ "Returns", "a", "FrozenList", "with", "other", "concatenated", "to", "the", "end", "of", "self", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/frozen.py#L34-L50
[ "def", "union", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "tuple", ")", ":", "other", "=", "list", "(", "other", ")", "return", "type", "(", "self", ")", "(", "super", "(", ")", ".", "__add__", "(", "other", ")",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FrozenList.difference
Returns a FrozenList with elements from other removed from self. Parameters ---------- other : array-like The array-like whose elements we are removing self. Returns ------- diff : FrozenList The collection difference between self and other.
pandas/core/indexes/frozen.py
def difference(self, other): """ Returns a FrozenList with elements from other removed from self. Parameters ---------- other : array-like The array-like whose elements we are removing self. Returns ------- diff : FrozenList The c...
def difference(self, other): """ Returns a FrozenList with elements from other removed from self. Parameters ---------- other : array-like The array-like whose elements we are removing self. Returns ------- diff : FrozenList The c...
[ "Returns", "a", "FrozenList", "with", "elements", "from", "other", "removed", "from", "self", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/frozen.py#L52-L68
[ "def", "difference", "(", "self", ",", "other", ")", ":", "other", "=", "set", "(", "other", ")", "temp", "=", "[", "x", "for", "x", "in", "self", "if", "x", "not", "in", "other", "]", "return", "type", "(", "self", ")", "(", "temp", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FrozenNDArray.searchsorted
Find indices to insert `value` so as to maintain order. For full documentation, see `numpy.searchsorted` See Also -------- numpy.searchsorted : Equivalent function.
pandas/core/indexes/frozen.py
def searchsorted(self, value, side="left", sorter=None): """ Find indices to insert `value` so as to maintain order. For full documentation, see `numpy.searchsorted` See Also -------- numpy.searchsorted : Equivalent function. """ # We are much more perf...
def searchsorted(self, value, side="left", sorter=None): """ Find indices to insert `value` so as to maintain order. For full documentation, see `numpy.searchsorted` See Also -------- numpy.searchsorted : Equivalent function. """ # We are much more perf...
[ "Find", "indices", "to", "insert", "value", "so", "as", "to", "maintain", "order", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/frozen.py#L161-L184
[ "def", "searchsorted", "(", "self", ",", "value", ",", "side", "=", "\"left\"", ",", "sorter", "=", "None", ")", ":", "# We are much more performant if the searched", "# indexer is the same type as the array.", "#", "# This doesn't matter for int64, but DOES", "# matter for s...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
arrays_to_mgr
Segregate Series based on type and coerce into matrices. Needs to handle a lot of exceptional cases.
pandas/core/internals/construction.py
def arrays_to_mgr(arrays, arr_names, index, columns, dtype=None): """ Segregate Series based on type and coerce into matrices. Needs to handle a lot of exceptional cases. """ # figure out the index, if necessary if index is None: index = extract_index(arrays) else: index = e...
def arrays_to_mgr(arrays, arr_names, index, columns, dtype=None): """ Segregate Series based on type and coerce into matrices. Needs to handle a lot of exceptional cases. """ # figure out the index, if necessary if index is None: index = extract_index(arrays) else: index = e...
[ "Segregate", "Series", "based", "on", "type", "and", "coerce", "into", "matrices", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/construction.py#L41-L59
[ "def", "arrays_to_mgr", "(", "arrays", ",", "arr_names", ",", "index", ",", "columns", ",", "dtype", "=", "None", ")", ":", "# figure out the index, if necessary", "if", "index", "is", "None", ":", "index", "=", "extract_index", "(", "arrays", ")", "else", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037