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
Docstring.method_returns_something
Check if the docstrings method can return something. Bare returns, returns valued None and returns from nested functions are disconsidered. Returns ------- bool Whether the docstrings method can return something.
scripts/validate_docstrings.py
def method_returns_something(self): ''' Check if the docstrings method can return something. Bare returns, returns valued None and returns from nested functions are disconsidered. Returns ------- bool Whether the docstrings method can return somethin...
def method_returns_something(self): ''' Check if the docstrings method can return something. Bare returns, returns valued None and returns from nested functions are disconsidered. Returns ------- bool Whether the docstrings method can return somethin...
[ "Check", "if", "the", "docstrings", "method", "can", "return", "something", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/scripts/validate_docstrings.py#L503-L535
[ "def", "method_returns_something", "(", "self", ")", ":", "def", "get_returns_not_on_nested_functions", "(", "node", ")", ":", "returns", "=", "[", "node", "]", "if", "isinstance", "(", "node", ",", "ast", ".", "Return", ")", "else", "[", "]", "for", "chil...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ExcelWriter._value_with_fmt
Convert numpy types to Python types for the Excel writers. Parameters ---------- val : object Value to be written into cells Returns ------- Tuple with the first element being the converted value and the second being an optional format
pandas/io/excel/_base.py
def _value_with_fmt(self, val): """Convert numpy types to Python types for the Excel writers. Parameters ---------- val : object Value to be written into cells Returns ------- Tuple with the first element being the converted value and the second ...
def _value_with_fmt(self, val): """Convert numpy types to Python types for the Excel writers. Parameters ---------- val : object Value to be written into cells Returns ------- Tuple with the first element being the converted value and the second ...
[ "Convert", "numpy", "types", "to", "Python", "types", "for", "the", "Excel", "writers", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_base.py#L675-L706
[ "def", "_value_with_fmt", "(", "self", ",", "val", ")", ":", "fmt", "=", "None", "if", "is_integer", "(", "val", ")", ":", "val", "=", "int", "(", "val", ")", "elif", "is_float", "(", "val", ")", ":", "val", "=", "float", "(", "val", ")", "elif",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ExcelWriter.check_extension
checks that path's extension against the Writer's supported extensions. If it isn't supported, raises UnsupportedFiletypeError.
pandas/io/excel/_base.py
def check_extension(cls, ext): """checks that path's extension against the Writer's supported extensions. If it isn't supported, raises UnsupportedFiletypeError.""" if ext.startswith('.'): ext = ext[1:] if not any(ext in extension for extension in cls.supported_extensions): ...
def check_extension(cls, ext): """checks that path's extension against the Writer's supported extensions. If it isn't supported, raises UnsupportedFiletypeError.""" if ext.startswith('.'): ext = ext[1:] if not any(ext in extension for extension in cls.supported_extensions): ...
[ "checks", "that", "path", "s", "extension", "against", "the", "Writer", "s", "supported", "extensions", ".", "If", "it", "isn", "t", "supported", "raises", "UnsupportedFiletypeError", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_base.py#L709-L720
[ "def", "check_extension", "(", "cls", ",", "ext", ")", ":", "if", "ext", ".", "startswith", "(", "'.'", ")", ":", "ext", "=", "ext", "[", "1", ":", "]", "if", "not", "any", "(", "ext", "in", "extension", "for", "extension", "in", "cls", ".", "sup...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ExcelFile.parse
Parse specified sheet(s) into a DataFrame Equivalent to read_excel(ExcelFile, ...) See the read_excel docstring for more info on accepted parameters
pandas/io/excel/_base.py
def parse(self, sheet_name=0, header=0, names=None, index_col=None, usecols=None, squeeze=False, converters=None, true_values=None, false_values=None, skiprows=None, ...
def parse(self, sheet_name=0, header=0, names=None, index_col=None, usecols=None, squeeze=False, converters=None, true_values=None, false_values=None, skiprows=None, ...
[ "Parse", "specified", "sheet", "(", "s", ")", "into", "a", "DataFrame" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_base.py#L771-L831
[ "def", "parse", "(", "self", ",", "sheet_name", "=", "0", ",", "header", "=", "0", ",", "names", "=", "None", ",", "index_col", "=", "None", ",", "usecols", "=", "None", ",", "squeeze", "=", "False", ",", "converters", "=", "None", ",", "true_values"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_validate_where
Validate that the where statement is of the right type. The type may either be String, Expr, or list-like of Exprs. Parameters ---------- w : String term expression, Expr, or list-like of Exprs. Returns ------- where : The original where clause if the check was successful. Raises ...
pandas/core/computation/pytables.py
def _validate_where(w): """ Validate that the where statement is of the right type. The type may either be String, Expr, or list-like of Exprs. Parameters ---------- w : String term expression, Expr, or list-like of Exprs. Returns ------- where : The original where clause if the c...
def _validate_where(w): """ Validate that the where statement is of the right type. The type may either be String, Expr, or list-like of Exprs. Parameters ---------- w : String term expression, Expr, or list-like of Exprs. Returns ------- where : The original where clause if the c...
[ "Validate", "that", "the", "where", "statement", "is", "of", "the", "right", "type", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L460-L483
[ "def", "_validate_where", "(", "w", ")", ":", "if", "not", "(", "isinstance", "(", "w", ",", "(", "Expr", ",", "str", ")", ")", "or", "is_list_like", "(", "w", ")", ")", ":", "raise", "TypeError", "(", "\"where must be passed as a string, Expr, \"", "\"or ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
maybe_expression
loose checking if s is a pytables-acceptable expression
pandas/core/computation/pytables.py
def maybe_expression(s): """ loose checking if s is a pytables-acceptable expression """ if not isinstance(s, str): return False ops = ExprVisitor.binary_ops + ExprVisitor.unary_ops + ('=',) # make sure we have an op at least return any(op in s for op in ops)
def maybe_expression(s): """ loose checking if s is a pytables-acceptable expression """ if not isinstance(s, str): return False ops = ExprVisitor.binary_ops + ExprVisitor.unary_ops + ('=',) # make sure we have an op at least return any(op in s for op in ops)
[ "loose", "checking", "if", "s", "is", "a", "pytables", "-", "acceptable", "expression" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L598-L605
[ "def", "maybe_expression", "(", "s", ")", ":", "if", "not", "isinstance", "(", "s", ",", "str", ")", ":", "return", "False", "ops", "=", "ExprVisitor", ".", "binary_ops", "+", "ExprVisitor", ".", "unary_ops", "+", "(", "'='", ",", ")", "# make sure we ha...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
BinOp.conform
inplace conform rhs
pandas/core/computation/pytables.py
def conform(self, rhs): """ inplace conform rhs """ if not is_list_like(rhs): rhs = [rhs] if isinstance(rhs, np.ndarray): rhs = rhs.ravel() return rhs
def conform(self, rhs): """ inplace conform rhs """ if not is_list_like(rhs): rhs = [rhs] if isinstance(rhs, np.ndarray): rhs = rhs.ravel() return rhs
[ "inplace", "conform", "rhs" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L132-L138
[ "def", "conform", "(", "self", ",", "rhs", ")", ":", "if", "not", "is_list_like", "(", "rhs", ")", ":", "rhs", "=", "[", "rhs", "]", "if", "isinstance", "(", "rhs", ",", "np", ".", "ndarray", ")", ":", "rhs", "=", "rhs", ".", "ravel", "(", ")",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
BinOp.generate
create and return the op string for this TermValue
pandas/core/computation/pytables.py
def generate(self, v): """ create and return the op string for this TermValue """ val = v.tostring(self.encoding) return "({lhs} {op} {val})".format(lhs=self.lhs, op=self.op, val=val)
def generate(self, v): """ create and return the op string for this TermValue """ val = v.tostring(self.encoding) return "({lhs} {op} {val})".format(lhs=self.lhs, op=self.op, val=val)
[ "create", "and", "return", "the", "op", "string", "for", "this", "TermValue" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L166-L169
[ "def", "generate", "(", "self", ",", "v", ")", ":", "val", "=", "v", ".", "tostring", "(", "self", ".", "encoding", ")", "return", "\"({lhs} {op} {val})\"", ".", "format", "(", "lhs", "=", "self", ".", "lhs", ",", "op", "=", "self", ".", "op", ",",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
BinOp.convert_value
convert the expression that is in the term to something that is accepted by pytables
pandas/core/computation/pytables.py
def convert_value(self, v): """ convert the expression that is in the term to something that is accepted by pytables """ def stringify(value): if self.encoding is not None: encoder = partial(pprint_thing_encoded, encoding=self.encodi...
def convert_value(self, v): """ convert the expression that is in the term to something that is accepted by pytables """ def stringify(value): if self.encoding is not None: encoder = partial(pprint_thing_encoded, encoding=self.encodi...
[ "convert", "the", "expression", "that", "is", "in", "the", "term", "to", "something", "that", "is", "accepted", "by", "pytables" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L171-L224
[ "def", "convert_value", "(", "self", ",", "v", ")", ":", "def", "stringify", "(", "value", ")", ":", "if", "self", ".", "encoding", "is", "not", "None", ":", "encoder", "=", "partial", "(", "pprint_thing_encoded", ",", "encoding", "=", "self", ".", "en...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FilterBinOp.invert
invert the filter
pandas/core/computation/pytables.py
def invert(self): """ invert the filter """ if self.filter is not None: f = list(self.filter) f[1] = self.generate_filter_op(invert=True) self.filter = tuple(f) return self
def invert(self): """ invert the filter """ if self.filter is not None: f = list(self.filter) f[1] = self.generate_filter_op(invert=True) self.filter = tuple(f) return self
[ "invert", "the", "filter" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L236-L242
[ "def", "invert", "(", "self", ")", ":", "if", "self", ".", "filter", "is", "not", "None", ":", "f", "=", "list", "(", "self", ".", "filter", ")", "f", "[", "1", "]", "=", "self", ".", "generate_filter_op", "(", "invert", "=", "True", ")", "self",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Expr.evaluate
create and return the numexpr condition and filter
pandas/core/computation/pytables.py
def evaluate(self): """ create and return the numexpr condition and filter """ try: self.condition = self.terms.prune(ConditionBinOp) except AttributeError: raise ValueError("cannot process expression [{expr}], [{slf}] " "is not a valid condi...
def evaluate(self): """ create and return the numexpr condition and filter """ try: self.condition = self.terms.prune(ConditionBinOp) except AttributeError: raise ValueError("cannot process expression [{expr}], [{slf}] " "is not a valid condi...
[ "create", "and", "return", "the", "numexpr", "condition", "and", "filter" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L556-L572
[ "def", "evaluate", "(", "self", ")", ":", "try", ":", "self", ".", "condition", "=", "self", ".", "terms", ".", "prune", "(", "ConditionBinOp", ")", "except", "AttributeError", ":", "raise", "ValueError", "(", "\"cannot process expression [{expr}], [{slf}] \"", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
TermValue.tostring
quote the string if not encoded else encode and return
pandas/core/computation/pytables.py
def tostring(self, encoding): """ quote the string if not encoded else encode and return """ if self.kind == 'string': if encoding is not None: return self.converted return '"{converted}"'.format(converted=self.converted) elif self.kind == 'flo...
def tostring(self, encoding): """ quote the string if not encoded else encode and return """ if self.kind == 'string': if encoding is not None: return self.converted return '"{converted}"'.format(converted=self.converted) elif self.kind == 'flo...
[ "quote", "the", "string", "if", "not", "encoded", "else", "encode", "and", "return" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/pytables.py#L584-L595
[ "def", "tostring", "(", "self", ",", "encoding", ")", ":", "if", "self", ".", "kind", "==", "'string'", ":", "if", "encoding", "is", "not", "None", ":", "return", "self", ".", "converted", "return", "'\"{converted}\"'", ".", "format", "(", "converted", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_ensure_decoded
if we have bytes, decode them to unicode
pandas/core/computation/common.py
def _ensure_decoded(s): """ if we have bytes, decode them to unicode """ if isinstance(s, (np.bytes_, bytes)): s = s.decode(pd.get_option('display.encoding')) return s
def _ensure_decoded(s): """ if we have bytes, decode them to unicode """ if isinstance(s, (np.bytes_, bytes)): s = s.decode(pd.get_option('display.encoding')) return s
[ "if", "we", "have", "bytes", "decode", "them", "to", "unicode" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/common.py#L11-L15
[ "def", "_ensure_decoded", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "(", "np", ".", "bytes_", ",", "bytes", ")", ")", ":", "s", "=", "s", ".", "decode", "(", "pd", ".", "get_option", "(", "'display.encoding'", ")", ")", "return", "s" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_result_type_many
wrapper around numpy.result_type which overcomes the NPY_MAXARGS (32) argument limit
pandas/core/computation/common.py
def _result_type_many(*arrays_and_dtypes): """ wrapper around numpy.result_type which overcomes the NPY_MAXARGS (32) argument limit """ try: return np.result_type(*arrays_and_dtypes) except ValueError: # we have > NPY_MAXARGS terms in our expression return reduce(np.result_type, ...
def _result_type_many(*arrays_and_dtypes): """ wrapper around numpy.result_type which overcomes the NPY_MAXARGS (32) argument limit """ try: return np.result_type(*arrays_and_dtypes) except ValueError: # we have > NPY_MAXARGS terms in our expression return reduce(np.result_type, ...
[ "wrapper", "around", "numpy", ".", "result_type", "which", "overcomes", "the", "NPY_MAXARGS", "(", "32", ")", "argument", "limit" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/common.py#L18-L25
[ "def", "_result_type_many", "(", "*", "arrays_and_dtypes", ")", ":", "try", ":", "return", "np", ".", "result_type", "(", "*", "arrays_and_dtypes", ")", "except", "ValueError", ":", "# we have > NPY_MAXARGS terms in our expression", "return", "reduce", "(", "np", "....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_argmin_with_skipna
If 'Series.argmin' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' itself should be a boolean
pandas/compat/numpy/function.py
def validate_argmin_with_skipna(skipna, args, kwargs): """ If 'Series.argmin' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' ...
def validate_argmin_with_skipna(skipna, args, kwargs): """ If 'Series.argmin' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' ...
[ "If", "Series", ".", "argmin", "is", "called", "via", "the", "numpy", "library", "the", "third", "parameter", "in", "its", "signature", "is", "out", "which", "takes", "either", "an", "ndarray", "or", "None", "so", "check", "if", "the", "skipna", "parameter...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L77-L88
[ "def", "validate_argmin_with_skipna", "(", "skipna", ",", "args", ",", "kwargs", ")", ":", "skipna", ",", "args", "=", "process_skipna", "(", "skipna", ",", "args", ")", "validate_argmin", "(", "args", ",", "kwargs", ")", "return", "skipna" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_argmax_with_skipna
If 'Series.argmax' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' itself should be a boolean
pandas/compat/numpy/function.py
def validate_argmax_with_skipna(skipna, args, kwargs): """ If 'Series.argmax' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' ...
def validate_argmax_with_skipna(skipna, args, kwargs): """ If 'Series.argmax' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' ...
[ "If", "Series", ".", "argmax", "is", "called", "via", "the", "numpy", "library", "the", "third", "parameter", "in", "its", "signature", "is", "out", "which", "takes", "either", "an", "ndarray", "or", "None", "so", "check", "if", "the", "skipna", "parameter...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L91-L102
[ "def", "validate_argmax_with_skipna", "(", "skipna", ",", "args", ",", "kwargs", ")", ":", "skipna", ",", "args", "=", "process_skipna", "(", "skipna", ",", "args", ")", "validate_argmax", "(", "args", ",", "kwargs", ")", "return", "skipna" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_argsort_with_ascending
If 'Categorical.argsort' is called via the 'numpy' library, the first parameter in its signature is 'axis', which takes either an integer or 'None', so check if the 'ascending' parameter has either integer type or is None, since 'ascending' itself should be a boolean
pandas/compat/numpy/function.py
def validate_argsort_with_ascending(ascending, args, kwargs): """ If 'Categorical.argsort' is called via the 'numpy' library, the first parameter in its signature is 'axis', which takes either an integer or 'None', so check if the 'ascending' parameter has either integer type or is None, since 'asce...
def validate_argsort_with_ascending(ascending, args, kwargs): """ If 'Categorical.argsort' is called via the 'numpy' library, the first parameter in its signature is 'axis', which takes either an integer or 'None', so check if the 'ascending' parameter has either integer type or is None, since 'asce...
[ "If", "Categorical", ".", "argsort", "is", "called", "via", "the", "numpy", "library", "the", "first", "parameter", "in", "its", "signature", "is", "axis", "which", "takes", "either", "an", "integer", "or", "None", "so", "check", "if", "the", "ascending", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L123-L137
[ "def", "validate_argsort_with_ascending", "(", "ascending", ",", "args", ",", "kwargs", ")", ":", "if", "is_integer", "(", "ascending", ")", "or", "ascending", "is", "None", ":", "args", "=", "(", "ascending", ",", ")", "+", "args", "ascending", "=", "True...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_clip_with_axis
If 'NDFrame.clip' is called via the numpy library, the third parameter in its signature is 'out', which can takes an ndarray, so check if the 'axis' parameter is an instance of ndarray, since 'axis' itself should either be an integer or None
pandas/compat/numpy/function.py
def validate_clip_with_axis(axis, args, kwargs): """ If 'NDFrame.clip' is called via the numpy library, the third parameter in its signature is 'out', which can takes an ndarray, so check if the 'axis' parameter is an instance of ndarray, since 'axis' itself should either be an integer or None "...
def validate_clip_with_axis(axis, args, kwargs): """ If 'NDFrame.clip' is called via the numpy library, the third parameter in its signature is 'out', which can takes an ndarray, so check if the 'axis' parameter is an instance of ndarray, since 'axis' itself should either be an integer or None "...
[ "If", "NDFrame", ".", "clip", "is", "called", "via", "the", "numpy", "library", "the", "third", "parameter", "in", "its", "signature", "is", "out", "which", "can", "takes", "an", "ndarray", "so", "check", "if", "the", "axis", "parameter", "is", "an", "in...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L145-L158
[ "def", "validate_clip_with_axis", "(", "axis", ",", "args", ",", "kwargs", ")", ":", "if", "isinstance", "(", "axis", ",", "ndarray", ")", ":", "args", "=", "(", "axis", ",", ")", "+", "args", "axis", "=", "None", "validate_clip", "(", "args", ",", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_cum_func_with_skipna
If this function is called via the 'numpy' library, the third parameter in its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so check if the 'skipna' parameter is a boolean or not
pandas/compat/numpy/function.py
def validate_cum_func_with_skipna(skipna, args, kwargs, name): """ If this function is called via the 'numpy' library, the third parameter in its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so check if the 'skipna' parameter is a boolean or not """ if not is_bool(skip...
def validate_cum_func_with_skipna(skipna, args, kwargs, name): """ If this function is called via the 'numpy' library, the third parameter in its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so check if the 'skipna' parameter is a boolean or not """ if not is_bool(skip...
[ "If", "this", "function", "is", "called", "via", "the", "numpy", "library", "the", "third", "parameter", "in", "its", "signature", "is", "dtype", "which", "takes", "either", "a", "numpy", "dtype", "or", "None", "so", "check", "if", "the", "skipna", "parame...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L176-L188
[ "def", "validate_cum_func_with_skipna", "(", "skipna", ",", "args", ",", "kwargs", ",", "name", ")", ":", "if", "not", "is_bool", "(", "skipna", ")", ":", "args", "=", "(", "skipna", ",", ")", "+", "args", "skipna", "=", "True", "validate_cum_func", "(",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_take_with_convert
If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None
pandas/compat/numpy/function.py
def validate_take_with_convert(convert, args, kwargs): """ If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None """ if isin...
def validate_take_with_convert(convert, args, kwargs): """ If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None """ if isin...
[ "If", "this", "function", "is", "called", "via", "the", "numpy", "library", "the", "third", "parameter", "in", "its", "signature", "is", "axis", "which", "takes", "either", "an", "ndarray", "or", "None", "so", "check", "if", "the", "convert", "parameter", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L269-L282
[ "def", "validate_take_with_convert", "(", "convert", ",", "args", ",", "kwargs", ")", ":", "if", "isinstance", "(", "convert", ",", "ndarray", ")", "or", "convert", "is", "None", ":", "args", "=", "(", "convert", ",", ")", "+", "args", "convert", "=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_groupby_func
'args' and 'kwargs' should be empty, except for allowed kwargs because all of their necessary parameters are explicitly listed in the function signature
pandas/compat/numpy/function.py
def validate_groupby_func(name, args, kwargs, allowed=None): """ 'args' and 'kwargs' should be empty, except for allowed kwargs because all of their necessary parameters are explicitly listed in the function signature """ if allowed is None: allowed = [] kwargs = set(kwargs) - s...
def validate_groupby_func(name, args, kwargs, allowed=None): """ 'args' and 'kwargs' should be empty, except for allowed kwargs because all of their necessary parameters are explicitly listed in the function signature """ if allowed is None: allowed = [] kwargs = set(kwargs) - s...
[ "args", "and", "kwargs", "should", "be", "empty", "except", "for", "allowed", "kwargs", "because", "all", "of", "their", "necessary", "parameters", "are", "explicitly", "listed", "in", "the", "function", "signature" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L349-L365
[ "def", "validate_groupby_func", "(", "name", ",", "args", ",", "kwargs", ",", "allowed", "=", "None", ")", ":", "if", "allowed", "is", "None", ":", "allowed", "=", "[", "]", "kwargs", "=", "set", "(", "kwargs", ")", "-", "set", "(", "allowed", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_resampler_func
'args' and 'kwargs' should be empty because all of their necessary parameters are explicitly listed in the function signature
pandas/compat/numpy/function.py
def validate_resampler_func(method, args, kwargs): """ 'args' and 'kwargs' should be empty because all of their necessary parameters are explicitly listed in the function signature """ if len(args) + len(kwargs) > 0: if method in RESAMPLER_NUMPY_OPS: raise UnsupportedFunction...
def validate_resampler_func(method, args, kwargs): """ 'args' and 'kwargs' should be empty because all of their necessary parameters are explicitly listed in the function signature """ if len(args) + len(kwargs) > 0: if method in RESAMPLER_NUMPY_OPS: raise UnsupportedFunction...
[ "args", "and", "kwargs", "should", "be", "empty", "because", "all", "of", "their", "necessary", "parameters", "are", "explicitly", "listed", "in", "the", "function", "signature" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L372-L385
[ "def", "validate_resampler_func", "(", "method", ",", "args", ",", "kwargs", ")", ":", "if", "len", "(", "args", ")", "+", "len", "(", "kwargs", ")", ">", "0", ":", "if", "method", "in", "RESAMPLER_NUMPY_OPS", ":", "raise", "UnsupportedFunctionCall", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_minmax_axis
Ensure that the axis argument passed to min, max, argmin, or argmax is zero or None, as otherwise it will be incorrectly ignored. Parameters ---------- axis : int or None Raises ------ ValueError
pandas/compat/numpy/function.py
def validate_minmax_axis(axis): """ Ensure that the axis argument passed to min, max, argmin, or argmax is zero or None, as otherwise it will be incorrectly ignored. Parameters ---------- axis : int or None Raises ------ ValueError """ ndim = 1 # hard-coded for Index i...
def validate_minmax_axis(axis): """ Ensure that the axis argument passed to min, max, argmin, or argmax is zero or None, as otherwise it will be incorrectly ignored. Parameters ---------- axis : int or None Raises ------ ValueError """ ndim = 1 # hard-coded for Index i...
[ "Ensure", "that", "the", "axis", "argument", "passed", "to", "min", "max", "argmin", "or", "argmax", "is", "zero", "or", "None", "as", "otherwise", "it", "will", "be", "incorrectly", "ignored", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/compat/numpy/function.py#L388-L406
[ "def", "validate_minmax_axis", "(", "axis", ")", ":", "ndim", "=", "1", "# hard-coded for Index", "if", "axis", "is", "None", ":", "return", "if", "axis", ">=", "ndim", "or", "(", "axis", "<", "0", "and", "ndim", "+", "axis", "<", "0", ")", ":", "rai...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
to_msgpack
msgpack (serialize) object to input file path THIS IS AN EXPERIMENTAL LIBRARY and the storage format may not be stable until a future release. Parameters ---------- path_or_buf : string File path, buffer-like, or None if None, return generated string args : an object or objec...
pandas/io/packers.py
def to_msgpack(path_or_buf, *args, **kwargs): """ msgpack (serialize) object to input file path THIS IS AN EXPERIMENTAL LIBRARY and the storage format may not be stable until a future release. Parameters ---------- path_or_buf : string File path, buffer-like, or None if N...
def to_msgpack(path_or_buf, *args, **kwargs): """ msgpack (serialize) object to input file path THIS IS AN EXPERIMENTAL LIBRARY and the storage format may not be stable until a future release. Parameters ---------- path_or_buf : string File path, buffer-like, or None if N...
[ "msgpack", "(", "serialize", ")", "object", "to", "input", "file", "path" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L118-L157
[ "def", "to_msgpack", "(", "path_or_buf", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "global", "compressor", "compressor", "=", "kwargs", ".", "pop", "(", "'compress'", ",", "None", ")", "append", "=", "kwargs", ".", "pop", "(", "'append'", ",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
read_msgpack
Load msgpack pandas object from the specified file path THIS IS AN EXPERIMENTAL LIBRARY and the storage format may not be stable until a future release. Parameters ---------- path_or_buf : string File path, BytesIO like or string encoding : Encoding for decoding msgpack str type iterat...
pandas/io/packers.py
def read_msgpack(path_or_buf, encoding='utf-8', iterator=False, **kwargs): """ Load msgpack pandas object from the specified file path THIS IS AN EXPERIMENTAL LIBRARY and the storage format may not be stable until a future release. Parameters ---------- path_or_buf : string File path, ...
def read_msgpack(path_or_buf, encoding='utf-8', iterator=False, **kwargs): """ Load msgpack pandas object from the specified file path THIS IS AN EXPERIMENTAL LIBRARY and the storage format may not be stable until a future release. Parameters ---------- path_or_buf : string File path, ...
[ "Load", "msgpack", "pandas", "object", "from", "the", "specified", "file", "path" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L160-L219
[ "def", "read_msgpack", "(", "path_or_buf", ",", "encoding", "=", "'utf-8'", ",", "iterator", "=", "False", ",", "*", "*", "kwargs", ")", ":", "path_or_buf", ",", "_", ",", "_", ",", "should_close", "=", "get_filepath_or_buffer", "(", "path_or_buf", ")", "i...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
dtype_for
return my dtype mapping, whether number or name
pandas/io/packers.py
def dtype_for(t): """ return my dtype mapping, whether number or name """ if t in dtype_dict: return dtype_dict[t] return np.typeDict.get(t, t)
def dtype_for(t): """ return my dtype mapping, whether number or name """ if t in dtype_dict: return dtype_dict[t] return np.typeDict.get(t, t)
[ "return", "my", "dtype", "mapping", "whether", "number", "or", "name" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L236-L240
[ "def", "dtype_for", "(", "t", ")", ":", "if", "t", "in", "dtype_dict", ":", "return", "dtype_dict", "[", "t", "]", "return", "np", ".", "typeDict", ".", "get", "(", "t", ",", "t", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
c2f
Convert strings to complex number instance with specified numpy type.
pandas/io/packers.py
def c2f(r, i, ctype_name): """ Convert strings to complex number instance with specified numpy type. """ ftype = c2f_dict[ctype_name] return np.typeDict[ctype_name](ftype(r) + 1j * ftype(i))
def c2f(r, i, ctype_name): """ Convert strings to complex number instance with specified numpy type. """ ftype = c2f_dict[ctype_name] return np.typeDict[ctype_name](ftype(r) + 1j * ftype(i))
[ "Convert", "strings", "to", "complex", "number", "instance", "with", "specified", "numpy", "type", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L252-L258
[ "def", "c2f", "(", "r", ",", "i", ",", "ctype_name", ")", ":", "ftype", "=", "c2f_dict", "[", "ctype_name", "]", "return", "np", ".", "typeDict", "[", "ctype_name", "]", "(", "ftype", "(", "r", ")", "+", "1j", "*", "ftype", "(", "i", ")", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
convert
convert the numpy values to a list
pandas/io/packers.py
def convert(values): """ convert the numpy values to a list """ dtype = values.dtype if is_categorical_dtype(values): return values elif is_object_dtype(dtype): return values.ravel().tolist() if needs_i8_conversion(dtype): values = values.view('i8') v = values.ravel()...
def convert(values): """ convert the numpy values to a list """ dtype = values.dtype if is_categorical_dtype(values): return values elif is_object_dtype(dtype): return values.ravel().tolist() if needs_i8_conversion(dtype): values = values.view('i8') v = values.ravel()...
[ "convert", "the", "numpy", "values", "to", "a", "list" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L261-L299
[ "def", "convert", "(", "values", ")", ":", "dtype", "=", "values", ".", "dtype", "if", "is_categorical_dtype", "(", "values", ")", ":", "return", "values", "elif", "is_object_dtype", "(", "dtype", ")", ":", "return", "values", ".", "ravel", "(", ")", "."...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
encode
Data encoder
pandas/io/packers.py
def encode(obj): """ Data encoder """ tobj = type(obj) if isinstance(obj, Index): if isinstance(obj, RangeIndex): return {'typ': 'range_index', 'klass': obj.__class__.__name__, 'name': getattr(obj, 'name', None), 'start'...
def encode(obj): """ Data encoder """ tobj = type(obj) if isinstance(obj, Index): if isinstance(obj, RangeIndex): return {'typ': 'range_index', 'klass': obj.__class__.__name__, 'name': getattr(obj, 'name', None), 'start'...
[ "Data", "encoder" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L360-L560
[ "def", "encode", "(", "obj", ")", ":", "tobj", "=", "type", "(", "obj", ")", "if", "isinstance", "(", "obj", ",", "Index", ")", ":", "if", "isinstance", "(", "obj", ",", "RangeIndex", ")", ":", "return", "{", "'typ'", ":", "'range_index'", ",", "'k...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
decode
Decoder for deserializing numpy data types.
pandas/io/packers.py
def decode(obj): """ Decoder for deserializing numpy data types. """ typ = obj.get('typ') if typ is None: return obj elif typ == 'timestamp': freq = obj['freq'] if 'freq' in obj else obj['offset'] return Timestamp(obj['value'], tz=obj['tz'], freq=freq) elif typ == 'n...
def decode(obj): """ Decoder for deserializing numpy data types. """ typ = obj.get('typ') if typ is None: return obj elif typ == 'timestamp': freq = obj['freq'] if 'freq' in obj else obj['offset'] return Timestamp(obj['value'], tz=obj['tz'], freq=freq) elif typ == 'n...
[ "Decoder", "for", "deserializing", "numpy", "data", "types", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L563-L711
[ "def", "decode", "(", "obj", ")", ":", "typ", "=", "obj", ".", "get", "(", "'typ'", ")", "if", "typ", "is", "None", ":", "return", "obj", "elif", "typ", "==", "'timestamp'", ":", "freq", "=", "obj", "[", "'freq'", "]", "if", "'freq'", "in", "obj"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
pack
Pack an object and return the packed bytes.
pandas/io/packers.py
def pack(o, default=encode, encoding='utf-8', unicode_errors='strict', use_single_float=False, autoreset=1, use_bin_type=1): """ Pack an object and return the packed bytes. """ return Packer(default=default, encoding=encoding, unicode_errors=unicode_errors, ...
def pack(o, default=encode, encoding='utf-8', unicode_errors='strict', use_single_float=False, autoreset=1, use_bin_type=1): """ Pack an object and return the packed bytes. """ return Packer(default=default, encoding=encoding, unicode_errors=unicode_errors, ...
[ "Pack", "an", "object", "and", "return", "the", "packed", "bytes", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L714-L725
[ "def", "pack", "(", "o", ",", "default", "=", "encode", ",", "encoding", "=", "'utf-8'", ",", "unicode_errors", "=", "'strict'", ",", "use_single_float", "=", "False", ",", "autoreset", "=", "1", ",", "use_bin_type", "=", "1", ")", ":", "return", "Packer...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
unpack
Unpack a packed object, return an iterator Note: packed lists will be returned as tuples
pandas/io/packers.py
def unpack(packed, object_hook=decode, list_hook=None, use_list=False, encoding='utf-8', unicode_errors='strict', object_pairs_hook=None, max_buffer_size=0, ext_hook=ExtType): """ Unpack a packed object, return an iterator Note: packed lists will be returned as tuples ""...
def unpack(packed, object_hook=decode, list_hook=None, use_list=False, encoding='utf-8', unicode_errors='strict', object_pairs_hook=None, max_buffer_size=0, ext_hook=ExtType): """ Unpack a packed object, return an iterator Note: packed lists will be returned as tuples ""...
[ "Unpack", "a", "packed", "object", "return", "an", "iterator", "Note", ":", "packed", "lists", "will", "be", "returned", "as", "tuples" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/packers.py#L728-L743
[ "def", "unpack", "(", "packed", ",", "object_hook", "=", "decode", ",", "list_hook", "=", "None", ",", "use_list", "=", "False", ",", "encoding", "=", "'utf-8'", ",", "unicode_errors", "=", "'strict'", ",", "object_pairs_hook", "=", "None", ",", "max_buffer_...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
read_json
Convert a JSON string to pandas object. Parameters ---------- path_or_buf : a valid JSON string or file-like, default: None The string could be a URL. Valid URL schemes include http, ftp, s3, gcs, and file. For file URLs, a host is expected. For instance, a local file could be ``fil...
pandas/io/json/json.py
def read_json(path_or_buf=None, orient=None, typ='frame', dtype=None, convert_axes=None, convert_dates=True, keep_default_dates=True, numpy=False, precise_float=False, date_unit=None, encoding=None, lines=False, chunksize=None, compression='infer'): """ Convert a JSON s...
def read_json(path_or_buf=None, orient=None, typ='frame', dtype=None, convert_axes=None, convert_dates=True, keep_default_dates=True, numpy=False, precise_float=False, date_unit=None, encoding=None, lines=False, chunksize=None, compression='infer'): """ Convert a JSON s...
[ "Convert", "a", "JSON", "string", "to", "pandas", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L222-L450
[ "def", "read_json", "(", "path_or_buf", "=", "None", ",", "orient", "=", "None", ",", "typ", "=", "'frame'", ",", "dtype", "=", "None", ",", "convert_axes", "=", "None", ",", "convert_dates", "=", "True", ",", "keep_default_dates", "=", "True", ",", "num...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FrameWriter._format_axes
Try to format axes if they are datelike.
pandas/io/json/json.py
def _format_axes(self): """ Try to format axes if they are datelike. """ if not self.obj.index.is_unique and self.orient in ( 'index', 'columns'): raise ValueError("DataFrame index must be unique for orient=" "'{orient}'.".format(o...
def _format_axes(self): """ Try to format axes if they are datelike. """ if not self.obj.index.is_unique and self.orient in ( 'index', 'columns'): raise ValueError("DataFrame index must be unique for orient=" "'{orient}'.".format(o...
[ "Try", "to", "format", "axes", "if", "they", "are", "datelike", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L138-L149
[ "def", "_format_axes", "(", "self", ")", ":", "if", "not", "self", ".", "obj", ".", "index", ".", "is_unique", "and", "self", ".", "orient", "in", "(", "'index'", ",", "'columns'", ")", ":", "raise", "ValueError", "(", "\"DataFrame index must be unique for o...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
JsonReader._preprocess_data
At this point, the data either has a `read` attribute (e.g. a file object or a StringIO) or is a string that is a JSON document. If self.chunksize, we prepare the data for the `__next__` method. Otherwise, we read it into memory for the `read` method.
pandas/io/json/json.py
def _preprocess_data(self, data): """ At this point, the data either has a `read` attribute (e.g. a file object or a StringIO) or is a string that is a JSON document. If self.chunksize, we prepare the data for the `__next__` method. Otherwise, we read it into memory for the `rea...
def _preprocess_data(self, data): """ At this point, the data either has a `read` attribute (e.g. a file object or a StringIO) or is a string that is a JSON document. If self.chunksize, we prepare the data for the `__next__` method. Otherwise, we read it into memory for the `rea...
[ "At", "this", "point", "the", "data", "either", "has", "a", "read", "attribute", "(", "e", ".", "g", ".", "a", "file", "object", "or", "a", "StringIO", ")", "or", "is", "a", "string", "that", "is", "a", "JSON", "document", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L490-L503
[ "def", "_preprocess_data", "(", "self", ",", "data", ")", ":", "if", "hasattr", "(", "data", ",", "'read'", ")", "and", "not", "self", ".", "chunksize", ":", "data", "=", "data", ".", "read", "(", ")", "if", "not", "hasattr", "(", "data", ",", "'re...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
JsonReader._get_data_from_filepath
The function read_json accepts three input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO) 3. JSON string This method turns (1) into (2) to simplify the rest of the processing. It returns input types (2) and (3) unchanged.
pandas/io/json/json.py
def _get_data_from_filepath(self, filepath_or_buffer): """ The function read_json accepts three input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO) 3. JSON string This method turns (1) into (2) to simplify the rest of ...
def _get_data_from_filepath(self, filepath_or_buffer): """ The function read_json accepts three input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO) 3. JSON string This method turns (1) into (2) to simplify the rest of ...
[ "The", "function", "read_json", "accepts", "three", "input", "types", ":", "1", ".", "filepath", "(", "string", "-", "like", ")", "2", ".", "file", "-", "like", "object", "(", "e", ".", "g", ".", "open", "file", "object", "StringIO", ")", "3", ".", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L505-L532
[ "def", "_get_data_from_filepath", "(", "self", ",", "filepath_or_buffer", ")", ":", "data", "=", "filepath_or_buffer", "exists", "=", "False", "if", "isinstance", "(", "data", ",", "str", ")", ":", "try", ":", "exists", "=", "os", ".", "path", ".", "exists...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
JsonReader._combine_lines
Combines a list of JSON objects into one JSON object.
pandas/io/json/json.py
def _combine_lines(self, lines): """ Combines a list of JSON objects into one JSON object. """ lines = filter(None, map(lambda x: x.strip(), lines)) return '[' + ','.join(lines) + ']'
def _combine_lines(self, lines): """ Combines a list of JSON objects into one JSON object. """ lines = filter(None, map(lambda x: x.strip(), lines)) return '[' + ','.join(lines) + ']'
[ "Combines", "a", "list", "of", "JSON", "objects", "into", "one", "JSON", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L534-L539
[ "def", "_combine_lines", "(", "self", ",", "lines", ")", ":", "lines", "=", "filter", "(", "None", ",", "map", "(", "lambda", "x", ":", "x", ".", "strip", "(", ")", ",", "lines", ")", ")", "return", "'['", "+", "','", ".", "join", "(", "lines", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
JsonReader.read
Read the whole JSON input into a pandas object.
pandas/io/json/json.py
def read(self): """ Read the whole JSON input into a pandas object. """ if self.lines and self.chunksize: obj = concat(self) elif self.lines: data = to_str(self.data) obj = self._get_object_parser( self._combine_lines(data.spli...
def read(self): """ Read the whole JSON input into a pandas object. """ if self.lines and self.chunksize: obj = concat(self) elif self.lines: data = to_str(self.data) obj = self._get_object_parser( self._combine_lines(data.spli...
[ "Read", "the", "whole", "JSON", "input", "into", "a", "pandas", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L541-L556
[ "def", "read", "(", "self", ")", ":", "if", "self", ".", "lines", "and", "self", ".", "chunksize", ":", "obj", "=", "concat", "(", "self", ")", "elif", "self", ".", "lines", ":", "data", "=", "to_str", "(", "self", ".", "data", ")", "obj", "=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
JsonReader._get_object_parser
Parses a json document into a pandas object.
pandas/io/json/json.py
def _get_object_parser(self, json): """ Parses a json document into a pandas object. """ typ = self.typ dtype = self.dtype kwargs = { "orient": self.orient, "dtype": self.dtype, "convert_axes": self.convert_axes, "convert_dates": self.c...
def _get_object_parser(self, json): """ Parses a json document into a pandas object. """ typ = self.typ dtype = self.dtype kwargs = { "orient": self.orient, "dtype": self.dtype, "convert_axes": self.convert_axes, "convert_dates": self.c...
[ "Parses", "a", "json", "document", "into", "a", "pandas", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L558-L580
[ "def", "_get_object_parser", "(", "self", ",", "json", ")", ":", "typ", "=", "self", ".", "typ", "dtype", "=", "self", ".", "dtype", "kwargs", "=", "{", "\"orient\"", ":", "self", ".", "orient", ",", "\"dtype\"", ":", "self", ".", "dtype", ",", "\"co...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Parser.check_keys_split
Checks that dict has only the appropriate keys for orient='split'.
pandas/io/json/json.py
def check_keys_split(self, decoded): """ Checks that dict has only the appropriate keys for orient='split'. """ bad_keys = set(decoded.keys()).difference(set(self._split_keys)) if bad_keys: bad_keys = ", ".join(bad_keys) raise ValueError("JSON data had une...
def check_keys_split(self, decoded): """ Checks that dict has only the appropriate keys for orient='split'. """ bad_keys = set(decoded.keys()).difference(set(self._split_keys)) if bad_keys: bad_keys = ", ".join(bad_keys) raise ValueError("JSON data had une...
[ "Checks", "that", "dict", "has", "only", "the", "appropriate", "keys", "for", "orient", "=", "split", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L651-L659
[ "def", "check_keys_split", "(", "self", ",", "decoded", ")", ":", "bad_keys", "=", "set", "(", "decoded", ".", "keys", "(", ")", ")", ".", "difference", "(", "set", "(", "self", ".", "_split_keys", ")", ")", "if", "bad_keys", ":", "bad_keys", "=", "\...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Parser._convert_axes
Try to convert axes.
pandas/io/json/json.py
def _convert_axes(self): """ Try to convert axes. """ for axis in self.obj._AXIS_NUMBERS.keys(): new_axis, result = self._try_convert_data( axis, self.obj._get_axis(axis), use_dtypes=False, convert_dates=True) if result: ...
def _convert_axes(self): """ Try to convert axes. """ for axis in self.obj._AXIS_NUMBERS.keys(): new_axis, result = self._try_convert_data( axis, self.obj._get_axis(axis), use_dtypes=False, convert_dates=True) if result: ...
[ "Try", "to", "convert", "axes", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L678-L687
[ "def", "_convert_axes", "(", "self", ")", ":", "for", "axis", "in", "self", ".", "obj", ".", "_AXIS_NUMBERS", ".", "keys", "(", ")", ":", "new_axis", ",", "result", "=", "self", ".", "_try_convert_data", "(", "axis", ",", "self", ".", "obj", ".", "_g...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FrameParser._process_converter
Take a conversion function and possibly recreate the frame.
pandas/io/json/json.py
def _process_converter(self, f, filt=None): """ Take a conversion function and possibly recreate the frame. """ if filt is None: filt = lambda col, c: True needs_new_obj = False new_obj = dict() for i, (col, c) in enumerate(self.obj.iteritems()): ...
def _process_converter(self, f, filt=None): """ Take a conversion function and possibly recreate the frame. """ if filt is None: filt = lambda col, c: True needs_new_obj = False new_obj = dict() for i, (col, c) in enumerate(self.obj.iteritems()): ...
[ "Take", "a", "conversion", "function", "and", "possibly", "recreate", "the", "frame", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/json/json.py#L904-L927
[ "def", "_process_converter", "(", "self", ",", "f", ",", "filt", "=", "None", ")", ":", "if", "filt", "is", "None", ":", "filt", "=", "lambda", "col", ",", "c", ":", "True", "needs_new_obj", "=", "False", "new_obj", "=", "dict", "(", ")", "for", "i...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
format_array
Format an array for printing. Parameters ---------- values formatter float_format na_rep digits space justify decimal leading_space : bool, optional Whether the array should be formatted with a leading space. When an array as a column of a Series or DataFrame...
pandas/io/formats/format.py
def format_array(values, formatter, float_format=None, na_rep='NaN', digits=None, space=None, justify='right', decimal='.', leading_space=None): """ Format an array for printing. Parameters ---------- values formatter float_format na_rep digits ...
def format_array(values, formatter, float_format=None, na_rep='NaN', digits=None, space=None, justify='right', decimal='.', leading_space=None): """ Format an array for printing. Parameters ---------- values formatter float_format na_rep digits ...
[ "Format", "an", "array", "for", "printing", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L853-L912
[ "def", "format_array", "(", "values", ",", "formatter", ",", "float_format", "=", "None", ",", "na_rep", "=", "'NaN'", ",", "digits", "=", "None", ",", "space", "=", "None", ",", "justify", "=", "'right'", ",", "decimal", "=", "'.'", ",", "leading_space"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
format_percentiles
Outputs rounded and formatted percentiles. Parameters ---------- percentiles : list-like, containing floats from interval [0,1] Returns ------- formatted : list of strings Notes ----- Rounding precision is chosen so that: (1) if any two elements of ``percentiles`` differ, they...
pandas/io/formats/format.py
def format_percentiles(percentiles): """ Outputs rounded and formatted percentiles. Parameters ---------- percentiles : list-like, containing floats from interval [0,1] Returns ------- formatted : list of strings Notes ----- Rounding precision is chosen so that: (1) if any...
def format_percentiles(percentiles): """ Outputs rounded and formatted percentiles. Parameters ---------- percentiles : list-like, containing floats from interval [0,1] Returns ------- formatted : list of strings Notes ----- Rounding precision is chosen so that: (1) if any...
[ "Outputs", "rounded", "and", "formatted", "percentiles", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1208-L1268
[ "def", "format_percentiles", "(", "percentiles", ")", ":", "percentiles", "=", "np", ".", "asarray", "(", "percentiles", ")", "# It checks for np.NaN as well", "with", "np", ".", "errstate", "(", "invalid", "=", "'ignore'", ")", ":", "if", "not", "is_numeric_dty...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_format_timedelta64
Return a formatter function for a range of timedeltas. These will all have the same format argument If box, then show the return in quotes
pandas/io/formats/format.py
def _get_format_timedelta64(values, nat_rep='NaT', box=False): """ Return a formatter function for a range of timedeltas. These will all have the same format argument If box, then show the return in quotes """ values_int = values.astype(np.int64) consider_values = values_int != iNaT ...
def _get_format_timedelta64(values, nat_rep='NaT', box=False): """ Return a formatter function for a range of timedeltas. These will all have the same format argument If box, then show the return in quotes """ values_int = values.astype(np.int64) consider_values = values_int != iNaT ...
[ "Return", "a", "formatter", "function", "for", "a", "range", "of", "timedeltas", ".", "These", "will", "all", "have", "the", "same", "format", "argument" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1360-L1396
[ "def", "_get_format_timedelta64", "(", "values", ",", "nat_rep", "=", "'NaT'", ",", "box", "=", "False", ")", ":", "values_int", "=", "values", ".", "astype", "(", "np", ".", "int64", ")", "consider_values", "=", "values_int", "!=", "iNaT", "one_day_nanos", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_trim_zeros_complex
Separates the real and imaginary parts from the complex number, and executes the _trim_zeros_float method on each of those.
pandas/io/formats/format.py
def _trim_zeros_complex(str_complexes, na_rep='NaN'): """ Separates the real and imaginary parts from the complex number, and executes the _trim_zeros_float method on each of those. """ def separate_and_trim(str_complex, na_rep): num_arr = str_complex.split('+') return (_trim_zeros_f...
def _trim_zeros_complex(str_complexes, na_rep='NaN'): """ Separates the real and imaginary parts from the complex number, and executes the _trim_zeros_float method on each of those. """ def separate_and_trim(str_complex, na_rep): num_arr = str_complex.split('+') return (_trim_zeros_f...
[ "Separates", "the", "real", "and", "imaginary", "parts", "from", "the", "complex", "number", "and", "executes", "the", "_trim_zeros_float", "method", "on", "each", "of", "those", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1427-L1439
[ "def", "_trim_zeros_complex", "(", "str_complexes", ",", "na_rep", "=", "'NaN'", ")", ":", "def", "separate_and_trim", "(", "str_complex", ",", "na_rep", ")", ":", "num_arr", "=", "str_complex", ".", "split", "(", "'+'", ")", "return", "(", "_trim_zeros_float"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_trim_zeros_float
Trims zeros, leaving just one before the decimal points if need be.
pandas/io/formats/format.py
def _trim_zeros_float(str_floats, na_rep='NaN'): """ Trims zeros, leaving just one before the decimal points if need be. """ trimmed = str_floats def _is_number(x): return (x != na_rep and not x.endswith('inf')) def _cond(values): finite = [x for x in values if _is_number(x)] ...
def _trim_zeros_float(str_floats, na_rep='NaN'): """ Trims zeros, leaving just one before the decimal points if need be. """ trimmed = str_floats def _is_number(x): return (x != na_rep and not x.endswith('inf')) def _cond(values): finite = [x for x in values if _is_number(x)] ...
[ "Trims", "zeros", "leaving", "just", "one", "before", "the", "decimal", "points", "if", "need", "be", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1442-L1461
[ "def", "_trim_zeros_float", "(", "str_floats", ",", "na_rep", "=", "'NaN'", ")", ":", "trimmed", "=", "str_floats", "def", "_is_number", "(", "x", ")", ":", "return", "(", "x", "!=", "na_rep", "and", "not", "x", ".", "endswith", "(", "'inf'", ")", ")",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
set_eng_float_format
Alter default behavior on how float is formatted in DataFrame. Format float in engineering format. By accuracy, we mean the number of decimal digits after the floating point. See also EngFormatter.
pandas/io/formats/format.py
def set_eng_float_format(accuracy=3, use_eng_prefix=False): """ Alter default behavior on how float is formatted in DataFrame. Format float in engineering format. By accuracy, we mean the number of decimal digits after the floating point. See also EngFormatter. """ set_option("display.floa...
def set_eng_float_format(accuracy=3, use_eng_prefix=False): """ Alter default behavior on how float is formatted in DataFrame. Format float in engineering format. By accuracy, we mean the number of decimal digits after the floating point. See also EngFormatter. """ set_option("display.floa...
[ "Alter", "default", "behavior", "on", "how", "float", "is", "formatted", "in", "DataFrame", ".", "Format", "float", "in", "engineering", "format", ".", "By", "accuracy", "we", "mean", "the", "number", "of", "decimal", "digits", "after", "the", "floating", "p...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1570-L1580
[ "def", "set_eng_float_format", "(", "accuracy", "=", "3", ",", "use_eng_prefix", "=", "False", ")", ":", "set_option", "(", "\"display.float_format\"", ",", "EngFormatter", "(", "accuracy", ",", "use_eng_prefix", ")", ")", "set_option", "(", "\"display.column_space\...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
get_level_lengths
For each index in each level the function returns lengths of indexes. Parameters ---------- levels : list of lists List of values on for level. sentinel : string, optional Value which states that no new index starts on there. Returns ---------- Returns list of maps. For eac...
pandas/io/formats/format.py
def get_level_lengths(levels, sentinel=''): """For each index in each level the function returns lengths of indexes. Parameters ---------- levels : list of lists List of values on for level. sentinel : string, optional Value which states that no new index starts on there. Retur...
def get_level_lengths(levels, sentinel=''): """For each index in each level the function returns lengths of indexes. Parameters ---------- levels : list of lists List of values on for level. sentinel : string, optional Value which states that no new index starts on there. Retur...
[ "For", "each", "index", "in", "each", "level", "the", "function", "returns", "lengths", "of", "indexes", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1603-L1640
[ "def", "get_level_lengths", "(", "levels", ",", "sentinel", "=", "''", ")", ":", "if", "len", "(", "levels", ")", "==", "0", ":", "return", "[", "]", "control", "=", "[", "True", "]", "*", "len", "(", "levels", "[", "0", "]", ")", "result", "=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
buffer_put_lines
Appends lines to a buffer. Parameters ---------- buf The buffer to write to lines The lines to append.
pandas/io/formats/format.py
def buffer_put_lines(buf, lines): """ Appends lines to a buffer. Parameters ---------- buf The buffer to write to lines The lines to append. """ if any(isinstance(x, str) for x in lines): lines = [str(x) for x in lines] buf.write('\n'.join(lines))
def buffer_put_lines(buf, lines): """ Appends lines to a buffer. Parameters ---------- buf The buffer to write to lines The lines to append. """ if any(isinstance(x, str) for x in lines): lines = [str(x) for x in lines] buf.write('\n'.join(lines))
[ "Appends", "lines", "to", "a", "buffer", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1643-L1656
[ "def", "buffer_put_lines", "(", "buf", ",", "lines", ")", ":", "if", "any", "(", "isinstance", "(", "x", ",", "str", ")", "for", "x", "in", "lines", ")", ":", "lines", "=", "[", "str", "(", "x", ")", "for", "x", "in", "lines", "]", "buf", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
EastAsianTextAdjustment.len
Calculate display width considering unicode East Asian Width
pandas/io/formats/format.py
def len(self, text): """ Calculate display width considering unicode East Asian Width """ if not isinstance(text, str): return len(text) return sum(self._EAW_MAP.get(east_asian_width(c), self.ambiguous_width) for c in text)
def len(self, text): """ Calculate display width considering unicode East Asian Width """ if not isinstance(text, str): return len(text) return sum(self._EAW_MAP.get(east_asian_width(c), self.ambiguous_width) for c in text)
[ "Calculate", "display", "width", "considering", "unicode", "East", "Asian", "Width" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L322-L330
[ "def", "len", "(", "self", ",", "text", ")", ":", "if", "not", "isinstance", "(", "text", ",", "str", ")", ":", "return", "len", "(", "text", ")", "return", "sum", "(", "self", ".", "_EAW_MAP", ".", "get", "(", "east_asian_width", "(", "c", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameFormatter._to_str_columns
Render a DataFrame to a list of columns (as lists of strings).
pandas/io/formats/format.py
def _to_str_columns(self): """ Render a DataFrame to a list of columns (as lists of strings). """ frame = self.tr_frame # may include levels names also str_index = self._get_formatted_index(frame) if not is_list_like(self.header) and not self.header: ...
def _to_str_columns(self): """ Render a DataFrame to a list of columns (as lists of strings). """ frame = self.tr_frame # may include levels names also str_index = self._get_formatted_index(frame) if not is_list_like(self.header) and not self.header: ...
[ "Render", "a", "DataFrame", "to", "a", "list", "of", "columns", "(", "as", "lists", "of", "strings", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L509-L590
[ "def", "_to_str_columns", "(", "self", ")", ":", "frame", "=", "self", ".", "tr_frame", "# may include levels names also", "str_index", "=", "self", ".", "_get_formatted_index", "(", "frame", ")", "if", "not", "is_list_like", "(", "self", ".", "header", ")", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameFormatter.to_string
Render a DataFrame to a console-friendly tabular output.
pandas/io/formats/format.py
def to_string(self): """ Render a DataFrame to a console-friendly tabular output. """ from pandas import Series frame = self.frame if len(frame.columns) == 0 or len(frame.index) == 0: info_line = ('Empty {name}\nColumns: {col}\nIndex: {idx}' ...
def to_string(self): """ Render a DataFrame to a console-friendly tabular output. """ from pandas import Series frame = self.frame if len(frame.columns) == 0 or len(frame.index) == 0: info_line = ('Empty {name}\nColumns: {col}\nIndex: {idx}' ...
[ "Render", "a", "DataFrame", "to", "a", "console", "-", "friendly", "tabular", "output", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L592-L650
[ "def", "to_string", "(", "self", ")", ":", "from", "pandas", "import", "Series", "frame", "=", "self", ".", "frame", "if", "len", "(", "frame", ".", "columns", ")", "==", "0", "or", "len", "(", "frame", ".", "index", ")", "==", "0", ":", "info_line...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameFormatter.to_latex
Render a DataFrame to a LaTeX tabular/longtable environment output.
pandas/io/formats/format.py
def to_latex(self, column_format=None, longtable=False, encoding=None, multicolumn=False, multicolumn_format=None, multirow=False): """ Render a DataFrame to a LaTeX tabular/longtable environment output. """ from pandas.io.formats.latex import LatexFormatter lat...
def to_latex(self, column_format=None, longtable=False, encoding=None, multicolumn=False, multicolumn_format=None, multirow=False): """ Render a DataFrame to a LaTeX tabular/longtable environment output. """ from pandas.io.formats.latex import LatexFormatter lat...
[ "Render", "a", "DataFrame", "to", "a", "LaTeX", "tabular", "/", "longtable", "environment", "output", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L686-L710
[ "def", "to_latex", "(", "self", ",", "column_format", "=", "None", ",", "longtable", "=", "False", ",", "encoding", "=", "None", ",", "multicolumn", "=", "False", ",", "multicolumn_format", "=", "None", ",", "multirow", "=", "False", ")", ":", "from", "p...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameFormatter.to_html
Render a DataFrame to a html table. Parameters ---------- classes : str or list-like classes to include in the `class` attribute of the opening ``<table>`` tag, in addition to the default "dataframe". notebook : {True, False}, optional, default False ...
pandas/io/formats/format.py
def to_html(self, classes=None, notebook=False, border=None): """ Render a DataFrame to a html table. Parameters ---------- classes : str or list-like classes to include in the `class` attribute of the opening ``<table>`` tag, in addition to the default "...
def to_html(self, classes=None, notebook=False, border=None): """ Render a DataFrame to a html table. Parameters ---------- classes : str or list-like classes to include in the `class` attribute of the opening ``<table>`` tag, in addition to the default "...
[ "Render", "a", "DataFrame", "to", "a", "html", "table", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L720-L747
[ "def", "to_html", "(", "self", ",", "classes", "=", "None", ",", "notebook", "=", "False", ",", "border", "=", "None", ")", ":", "from", "pandas", ".", "io", ".", "formats", ".", "html", "import", "HTMLFormatter", ",", "NotebookFormatter", "Klass", "=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FloatArrayFormatter._value_formatter
Returns a function to be applied on each value to format it
pandas/io/formats/format.py
def _value_formatter(self, float_format=None, threshold=None): """Returns a function to be applied on each value to format it """ # the float_format parameter supersedes self.float_format if float_format is None: float_format = self.float_format # we are going to co...
def _value_formatter(self, float_format=None, threshold=None): """Returns a function to be applied on each value to format it """ # the float_format parameter supersedes self.float_format if float_format is None: float_format = self.float_format # we are going to co...
[ "Returns", "a", "function", "to", "be", "applied", "on", "each", "value", "to", "format", "it" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1015-L1054
[ "def", "_value_formatter", "(", "self", ",", "float_format", "=", "None", ",", "threshold", "=", "None", ")", ":", "# the float_format parameter supersedes self.float_format", "if", "float_format", "is", "None", ":", "float_format", "=", "self", ".", "float_format", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
FloatArrayFormatter.get_result_as_array
Returns the float values converted into strings using the parameters given at initialisation, as a numpy array
pandas/io/formats/format.py
def get_result_as_array(self): """ Returns the float values converted into strings using the parameters given at initialisation, as a numpy array """ if self.formatter is not None: return np.array([self.formatter(x) for x in self.values]) if self.fixed_width...
def get_result_as_array(self): """ Returns the float values converted into strings using the parameters given at initialisation, as a numpy array """ if self.formatter is not None: return np.array([self.formatter(x) for x in self.values]) if self.fixed_width...
[ "Returns", "the", "float", "values", "converted", "into", "strings", "using", "the", "parameters", "given", "at", "initialisation", "as", "a", "numpy", "array" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1056-L1141
[ "def", "get_result_as_array", "(", "self", ")", ":", "if", "self", ".", "formatter", "is", "not", "None", ":", "return", "np", ".", "array", "(", "[", "self", ".", "formatter", "(", "x", ")", "for", "x", "in", "self", ".", "values", "]", ")", "if",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Datetime64Formatter._format_strings
we by definition have DO NOT have a TZ
pandas/io/formats/format.py
def _format_strings(self): """ we by definition have DO NOT have a TZ """ values = self.values if not isinstance(values, DatetimeIndex): values = DatetimeIndex(values) if self.formatter is not None and callable(self.formatter): return [self.formatter(x) for x i...
def _format_strings(self): """ we by definition have DO NOT have a TZ """ values = self.values if not isinstance(values, DatetimeIndex): values = DatetimeIndex(values) if self.formatter is not None and callable(self.formatter): return [self.formatter(x) for x i...
[ "we", "by", "definition", "have", "DO", "NOT", "have", "a", "TZ" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1166-L1182
[ "def", "_format_strings", "(", "self", ")", ":", "values", "=", "self", ".", "values", "if", "not", "isinstance", "(", "values", ",", "DatetimeIndex", ")", ":", "values", "=", "DatetimeIndex", "(", "values", ")", "if", "self", ".", "formatter", "is", "no...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
Datetime64TZFormatter._format_strings
we by definition have a TZ
pandas/io/formats/format.py
def _format_strings(self): """ we by definition have a TZ """ values = self.values.astype(object) is_dates_only = _is_dates_only(values) formatter = (self.formatter or _get_format_datetime64(is_dates_only, date_format=self...
def _format_strings(self): """ we by definition have a TZ """ values = self.values.astype(object) is_dates_only = _is_dates_only(values) formatter = (self.formatter or _get_format_datetime64(is_dates_only, date_format=self...
[ "we", "by", "definition", "have", "a", "TZ" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1332-L1342
[ "def", "_format_strings", "(", "self", ")", ":", "values", "=", "self", ".", "values", ".", "astype", "(", "object", ")", "is_dates_only", "=", "_is_dates_only", "(", "values", ")", "formatter", "=", "(", "self", ".", "formatter", "or", "_get_format_datetime...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_interval_closed_bounds
Given an Interval or IntervalIndex, return the corresponding interval with closed bounds.
pandas/core/indexes/interval.py
def _get_interval_closed_bounds(interval): """ Given an Interval or IntervalIndex, return the corresponding interval with closed bounds. """ left, right = interval.left, interval.right if interval.open_left: left = _get_next_label(left) if interval.open_right: right = _get_pr...
def _get_interval_closed_bounds(interval): """ Given an Interval or IntervalIndex, return the corresponding interval with closed bounds. """ left, right = interval.left, interval.right if interval.open_left: left = _get_next_label(left) if interval.open_right: right = _get_pr...
[ "Given", "an", "Interval", "or", "IntervalIndex", "return", "the", "corresponding", "interval", "with", "closed", "bounds", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/interval.py#L79-L89
[ "def", "_get_interval_closed_bounds", "(", "interval", ")", ":", "left", ",", "right", "=", "interval", ".", "left", ",", "interval", ".", "right", "if", "interval", ".", "open_left", ":", "left", "=", "_get_next_label", "(", "left", ")", "if", "interval", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_is_valid_endpoint
helper for interval_range to check if start/end are valid types
pandas/core/indexes/interval.py
def _is_valid_endpoint(endpoint): """helper for interval_range to check if start/end are valid types""" return any([is_number(endpoint), isinstance(endpoint, Timestamp), isinstance(endpoint, Timedelta), endpoint is None])
def _is_valid_endpoint(endpoint): """helper for interval_range to check if start/end are valid types""" return any([is_number(endpoint), isinstance(endpoint, Timestamp), isinstance(endpoint, Timedelta), endpoint is None])
[ "helper", "for", "interval_range", "to", "check", "if", "start", "/", "end", "are", "valid", "types" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/interval.py#L1138-L1143
[ "def", "_is_valid_endpoint", "(", "endpoint", ")", ":", "return", "any", "(", "[", "is_number", "(", "endpoint", ")", ",", "isinstance", "(", "endpoint", ",", "Timestamp", ")", ",", "isinstance", "(", "endpoint", ",", "Timedelta", ")", ",", "endpoint", "is...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_is_type_compatible
helper for interval_range to check type compat of start/end/freq
pandas/core/indexes/interval.py
def _is_type_compatible(a, b): """helper for interval_range to check type compat of start/end/freq""" is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset)) is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset)) return ((is_number(a) and is_number(b)) or (is_ts_compat(a) an...
def _is_type_compatible(a, b): """helper for interval_range to check type compat of start/end/freq""" is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset)) is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset)) return ((is_number(a) and is_number(b)) or (is_ts_compat(a) an...
[ "helper", "for", "interval_range", "to", "check", "type", "compat", "of", "start", "/", "end", "/", "freq" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/interval.py#L1146-L1153
[ "def", "_is_type_compatible", "(", "a", ",", "b", ")", ":", "is_ts_compat", "=", "lambda", "x", ":", "isinstance", "(", "x", ",", "(", "Timestamp", ",", "DateOffset", ")", ")", "is_td_compat", "=", "lambda", "x", ":", "isinstance", "(", "x", ",", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
interval_range
Return a fixed frequency IntervalIndex Parameters ---------- start : numeric or datetime-like, default None Left bound for generating intervals end : numeric or datetime-like, default None Right bound for generating intervals periods : integer, default None Number of periods...
pandas/core/indexes/interval.py
def interval_range(start=None, end=None, periods=None, freq=None, name=None, closed='right'): """ Return a fixed frequency IntervalIndex Parameters ---------- start : numeric or datetime-like, default None Left bound for generating intervals end : numeric or datetime-...
def interval_range(start=None, end=None, periods=None, freq=None, name=None, closed='right'): """ Return a fixed frequency IntervalIndex Parameters ---------- start : numeric or datetime-like, default None Left bound for generating intervals end : numeric or datetime-...
[ "Return", "a", "fixed", "frequency", "IntervalIndex" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/interval.py#L1156-L1312
[ "def", "interval_range", "(", "start", "=", "None", ",", "end", "=", "None", ",", "periods", "=", "None", ",", "freq", "=", "None", ",", "name", "=", "None", ",", "closed", "=", "'right'", ")", ":", "start", "=", "com", ".", "maybe_box_datetimelike", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
CSVFormatter.save
Create the writer & save
pandas/io/formats/csvs.py
def save(self): """ Create the writer & save """ # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, 'write'): msg = ("compression has no effect when passing file-like " "object as inpu...
def save(self): """ Create the writer & save """ # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, 'write'): msg = ("compression has no effect when passing file-like " "object as inpu...
[ "Create", "the", "writer", "&", "save" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/csvs.py#L125-L184
[ "def", "save", "(", "self", ")", ":", "# GH21227 internal compression is not used when file-like passed.", "if", "self", ".", "compression", "and", "hasattr", "(", "self", ".", "path_or_buf", ",", "'write'", ")", ":", "msg", "=", "(", "\"compression has no effect when...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
delegate_names
Add delegated names to a class using a class decorator. This provides an alternative usage to directly calling `_add_delegate_accessors` below a class definition. Parameters ---------- delegate : object the class to get methods/properties & doc-strings accessors : Sequence[str] ...
pandas/core/accessor.py
def delegate_names(delegate, accessors, typ, overwrite=False): """ Add delegated names to a class using a class decorator. This provides an alternative usage to directly calling `_add_delegate_accessors` below a class definition. Parameters ---------- delegate : object the class to...
def delegate_names(delegate, accessors, typ, overwrite=False): """ Add delegated names to a class using a class decorator. This provides an alternative usage to directly calling `_add_delegate_accessors` below a class definition. Parameters ---------- delegate : object the class to...
[ "Add", "delegated", "names", "to", "a", "class", "using", "a", "class", "decorator", ".", "This", "provides", "an", "alternative", "usage", "to", "directly", "calling", "_add_delegate_accessors", "below", "a", "class", "definition", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/accessor.py#L114-L146
[ "def", "delegate_names", "(", "delegate", ",", "accessors", ",", "typ", ",", "overwrite", "=", "False", ")", ":", "def", "add_delegate_accessors", "(", "cls", ")", ":", "cls", ".", "_add_delegate_accessors", "(", "delegate", ",", "accessors", ",", "typ", ","...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DirNamesMixin._dir_additions
Add additional __dir__ for this object.
pandas/core/accessor.py
def _dir_additions(self): """ Add additional __dir__ for this object. """ rv = set() for accessor in self._accessors: try: getattr(self, accessor) rv.add(accessor) except AttributeError: pass return r...
def _dir_additions(self): """ Add additional __dir__ for this object. """ rv = set() for accessor in self._accessors: try: getattr(self, accessor) rv.add(accessor) except AttributeError: pass return r...
[ "Add", "additional", "__dir__", "for", "this", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/accessor.py#L24-L35
[ "def", "_dir_additions", "(", "self", ")", ":", "rv", "=", "set", "(", ")", "for", "accessor", "in", "self", ".", "_accessors", ":", "try", ":", "getattr", "(", "self", ",", "accessor", ")", "rv", ".", "add", "(", "accessor", ")", "except", "Attribut...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PandasDelegate._add_delegate_accessors
Add accessors to cls from the delegate class. Parameters ---------- cls : the class to add the methods/properties to delegate : the class to get methods/properties & doc-strings accessors : string list of accessors to add typ : 'property' or 'method' overwrite : ...
pandas/core/accessor.py
def _add_delegate_accessors(cls, delegate, accessors, typ, overwrite=False): """ Add accessors to cls from the delegate class. Parameters ---------- cls : the class to add the methods/properties to delegate : the class to get methods/prope...
def _add_delegate_accessors(cls, delegate, accessors, typ, overwrite=False): """ Add accessors to cls from the delegate class. Parameters ---------- cls : the class to add the methods/properties to delegate : the class to get methods/prope...
[ "Add", "accessors", "to", "cls", "from", "the", "delegate", "class", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/accessor.py#L63-L111
[ "def", "_add_delegate_accessors", "(", "cls", ",", "delegate", ",", "accessors", ",", "typ", ",", "overwrite", "=", "False", ")", ":", "def", "_create_delegator_property", "(", "name", ")", ":", "def", "_getter", "(", "self", ")", ":", "return", "self", "....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_evaluate_standard
standard evaluation
pandas/core/computation/expressions.py
def _evaluate_standard(op, op_str, a, b, **eval_kwargs): """ standard evaluation """ if _TEST_MODE: _store_test_result(False) with np.errstate(all='ignore'): return op(a, b)
def _evaluate_standard(op, op_str, a, b, **eval_kwargs): """ standard evaluation """ if _TEST_MODE: _store_test_result(False) with np.errstate(all='ignore'): return op(a, b)
[ "standard", "evaluation" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expressions.py#L64-L69
[ "def", "_evaluate_standard", "(", "op", ",", "op_str", ",", "a", ",", "b", ",", "*", "*", "eval_kwargs", ")", ":", "if", "_TEST_MODE", ":", "_store_test_result", "(", "False", ")", "with", "np", ".", "errstate", "(", "all", "=", "'ignore'", ")", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_can_use_numexpr
return a boolean if we WILL be using numexpr
pandas/core/computation/expressions.py
def _can_use_numexpr(op, op_str, a, b, dtype_check): """ return a boolean if we WILL be using numexpr """ if op_str is not None: # required min elements (otherwise we are adding overhead) if np.prod(a.shape) > _MIN_ELEMENTS: # check for dtype compatibility dtypes = set(...
def _can_use_numexpr(op, op_str, a, b, dtype_check): """ return a boolean if we WILL be using numexpr """ if op_str is not None: # required min elements (otherwise we are adding overhead) if np.prod(a.shape) > _MIN_ELEMENTS: # check for dtype compatibility dtypes = set(...
[ "return", "a", "boolean", "if", "we", "WILL", "be", "using", "numexpr" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expressions.py#L72-L94
[ "def", "_can_use_numexpr", "(", "op", ",", "op_str", ",", "a", ",", "b", ",", "dtype_check", ")", ":", "if", "op_str", "is", "not", "None", ":", "# required min elements (otherwise we are adding overhead)", "if", "np", ".", "prod", "(", "a", ".", "shape", ")...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
evaluate
evaluate and return the expression of the op on a and b Parameters ---------- op : the actual operand op_str: the string version of the op a : left operand b : right operand use_numexpr : whether to try to use numexpr (default True)
pandas/core/computation/expressions.py
def evaluate(op, op_str, a, b, use_numexpr=True, **eval_kwargs): """ evaluate and return the expression of the op on a and b Parameters ---------- op : the actual operand op_str: the string version of the op a : left operand b : right operand...
def evaluate(op, op_str, a, b, use_numexpr=True, **eval_kwargs): """ evaluate and return the expression of the op on a and b Parameters ---------- op : the actual operand op_str: the string version of the op a : left operand b : right operand...
[ "evaluate", "and", "return", "the", "expression", "of", "the", "op", "on", "a", "and", "b" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expressions.py#L193-L210
[ "def", "evaluate", "(", "op", ",", "op_str", ",", "a", ",", "b", ",", "use_numexpr", "=", "True", ",", "*", "*", "eval_kwargs", ")", ":", "use_numexpr", "=", "use_numexpr", "and", "_bool_arith_check", "(", "op_str", ",", "a", ",", "b", ")", "if", "us...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
where
evaluate the where condition cond on a and b Parameters ---------- cond : a boolean array a : return if cond is True b : return if cond is False use_numexpr : whether to try to use numexpr (default True)
pandas/core/computation/expressions.py
def where(cond, a, b, use_numexpr=True): """ evaluate the where condition cond on a and b Parameters ---------- cond : a boolean array a : return if cond is True b : return if cond is False use_numexpr : whether to try to use numexpr (default True) """...
def where(cond, a, b, use_numexpr=True): """ evaluate the where condition cond on a and b Parameters ---------- cond : a boolean array a : return if cond is True b : return if cond is False use_numexpr : whether to try to use numexpr (default True) """...
[ "evaluate", "the", "where", "condition", "cond", "on", "a", "and", "b" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/expressions.py#L213-L227
[ "def", "where", "(", "cond", ",", "a", ",", "b", ",", "use_numexpr", "=", "True", ")", ":", "if", "use_numexpr", ":", "return", "_where", "(", "cond", ",", "a", ",", "b", ")", "return", "_where_standard", "(", "cond", ",", "a", ",", "b", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ExcelFormatter.write
writer : string or ExcelWriter object File path or existing ExcelWriter sheet_name : string, default 'Sheet1' Name of sheet which will contain DataFrame startrow : upper left cell row to dump data frame startcol : upper left cell column to dump dat...
pandas/io/formats/excel.py
def write(self, writer, sheet_name='Sheet1', startrow=0, startcol=0, freeze_panes=None, engine=None): """ writer : string or ExcelWriter object File path or existing ExcelWriter sheet_name : string, default 'Sheet1' Name of sheet which will contain DataFrame...
def write(self, writer, sheet_name='Sheet1', startrow=0, startcol=0, freeze_panes=None, engine=None): """ writer : string or ExcelWriter object File path or existing ExcelWriter sheet_name : string, default 'Sheet1' Name of sheet which will contain DataFrame...
[ "writer", ":", "string", "or", "ExcelWriter", "object", "File", "path", "or", "existing", "ExcelWriter", "sheet_name", ":", "string", "default", "Sheet1", "Name", "of", "sheet", "which", "will", "contain", "DataFrame", "startrow", ":", "upper", "left", "cell", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/excel.py#L629-L662
[ "def", "write", "(", "self", ",", "writer", ",", "sheet_name", "=", "'Sheet1'", ",", "startrow", "=", "0", ",", "startcol", "=", "0", ",", "freeze_panes", "=", "None", ",", "engine", "=", "None", ")", ":", "from", "pandas", ".", "io", ".", "excel", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
to_feather
Write a DataFrame to the feather-format Parameters ---------- df : DataFrame path : string file path, or file-like object
pandas/io/feather_format.py
def to_feather(df, path): """ Write a DataFrame to the feather-format Parameters ---------- df : DataFrame path : string file path, or file-like object """ path = _stringify_path(path) if not isinstance(df, DataFrame): raise ValueError("feather only support IO with DataFram...
def to_feather(df, path): """ Write a DataFrame to the feather-format Parameters ---------- df : DataFrame path : string file path, or file-like object """ path = _stringify_path(path) if not isinstance(df, DataFrame): raise ValueError("feather only support IO with DataFram...
[ "Write", "a", "DataFrame", "to", "the", "feather", "-", "format" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/feather_format.py#L36-L82
[ "def", "to_feather", "(", "df", ",", "path", ")", ":", "path", "=", "_stringify_path", "(", "path", ")", "if", "not", "isinstance", "(", "df", ",", "DataFrame", ")", ":", "raise", "ValueError", "(", "\"feather only support IO with DataFrames\"", ")", "feather"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
read_feather
Load a feather-format object from the file path .. versionadded 0.20.0 Parameters ---------- path : string file path, or file-like object columns : sequence, default None If not provided, all columns are read .. versionadded 0.24.0 nthreads : int, default 1 Number of C...
pandas/io/feather_format.py
def read_feather(path, columns=None, use_threads=True): """ Load a feather-format object from the file path .. versionadded 0.20.0 Parameters ---------- path : string file path, or file-like object columns : sequence, default None If not provided, all columns are read .. v...
def read_feather(path, columns=None, use_threads=True): """ Load a feather-format object from the file path .. versionadded 0.20.0 Parameters ---------- path : string file path, or file-like object columns : sequence, default None If not provided, all columns are read .. v...
[ "Load", "a", "feather", "-", "format", "object", "from", "the", "file", "path" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/feather_format.py#L86-L125
[ "def", "read_feather", "(", "path", ",", "columns", "=", "None", ",", "use_threads", "=", "True", ")", ":", "feather", ",", "pyarrow", "=", "_try_import", "(", ")", "path", "=", "_stringify_path", "(", "path", ")", "if", "LooseVersion", "(", "pyarrow", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
generate_regular_range
Generate a range of dates with the spans between dates described by the given `freq` DateOffset. Parameters ---------- start : Timestamp or None first point of produced date range end : Timestamp or None last point of produced date range periods : int number of periods i...
pandas/core/arrays/_ranges.py
def generate_regular_range(start, end, periods, freq): """ Generate a range of dates with the spans between dates described by the given `freq` DateOffset. Parameters ---------- start : Timestamp or None first point of produced date range end : Timestamp or None last point o...
def generate_regular_range(start, end, periods, freq): """ Generate a range of dates with the spans between dates described by the given `freq` DateOffset. Parameters ---------- start : Timestamp or None first point of produced date range end : Timestamp or None last point o...
[ "Generate", "a", "range", "of", "dates", "with", "the", "spans", "between", "dates", "described", "by", "the", "given", "freq", "DateOffset", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/_ranges.py#L13-L79
[ "def", "generate_regular_range", "(", "start", ",", "end", ",", "periods", ",", "freq", ")", ":", "if", "isinstance", "(", "freq", ",", "Tick", ")", ":", "stride", "=", "freq", ".", "nanos", "if", "periods", "is", "None", ":", "b", "=", "Timestamp", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_generate_range_overflow_safe
Calculate the second endpoint for passing to np.arange, checking to avoid an integer overflow. Catch OverflowError and re-raise as OutOfBoundsDatetime. Parameters ---------- endpoint : int nanosecond timestamp of the known endpoint of the desired range periods : int number of p...
pandas/core/arrays/_ranges.py
def _generate_range_overflow_safe(endpoint, periods, stride, side='start'): """ Calculate the second endpoint for passing to np.arange, checking to avoid an integer overflow. Catch OverflowError and re-raise as OutOfBoundsDatetime. Parameters ---------- endpoint : int nanosecond ti...
def _generate_range_overflow_safe(endpoint, periods, stride, side='start'): """ Calculate the second endpoint for passing to np.arange, checking to avoid an integer overflow. Catch OverflowError and re-raise as OutOfBoundsDatetime. Parameters ---------- endpoint : int nanosecond ti...
[ "Calculate", "the", "second", "endpoint", "for", "passing", "to", "np", ".", "arange", "checking", "to", "avoid", "an", "integer", "overflow", ".", "Catch", "OverflowError", "and", "re", "-", "raise", "as", "OutOfBoundsDatetime", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/_ranges.py#L82-L146
[ "def", "_generate_range_overflow_safe", "(", "endpoint", ",", "periods", ",", "stride", ",", "side", "=", "'start'", ")", ":", "# GH#14187 raise instead of incorrectly wrapping around", "assert", "side", "in", "[", "'start'", ",", "'end'", "]", "i64max", "=", "np", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_generate_range_overflow_safe_signed
A special case for _generate_range_overflow_safe where `periods * stride` can be calculated without overflowing int64 bounds.
pandas/core/arrays/_ranges.py
def _generate_range_overflow_safe_signed(endpoint, periods, stride, side): """ A special case for _generate_range_overflow_safe where `periods * stride` can be calculated without overflowing int64 bounds. """ assert side in ['start', 'end'] if side == 'end': stride *= -1 with np.err...
def _generate_range_overflow_safe_signed(endpoint, periods, stride, side): """ A special case for _generate_range_overflow_safe where `periods * stride` can be calculated without overflowing int64 bounds. """ assert side in ['start', 'end'] if side == 'end': stride *= -1 with np.err...
[ "A", "special", "case", "for", "_generate_range_overflow_safe", "where", "periods", "*", "stride", "can", "be", "calculated", "without", "overflowing", "int64", "bounds", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/_ranges.py#L149-L187
[ "def", "_generate_range_overflow_safe_signed", "(", "endpoint", ",", "periods", ",", "stride", ",", "side", ")", ":", "assert", "side", "in", "[", "'start'", ",", "'end'", "]", "if", "side", "==", "'end'", ":", "stride", "*=", "-", "1", "with", "np", "."...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
set_locale
Context manager for temporarily setting a locale. Parameters ---------- new_locale : str or tuple A string of the form <language_country>.<encoding>. For example to set the current locale to US English with a UTF8 encoding, you would pass "en_US.UTF-8". lc_var : int, default `lo...
pandas/_config/localization.py
def set_locale(new_locale, lc_var=locale.LC_ALL): """ Context manager for temporarily setting a locale. Parameters ---------- new_locale : str or tuple A string of the form <language_country>.<encoding>. For example to set the current locale to US English with a UTF8 encoding, you w...
def set_locale(new_locale, lc_var=locale.LC_ALL): """ Context manager for temporarily setting a locale. Parameters ---------- new_locale : str or tuple A string of the form <language_country>.<encoding>. For example to set the current locale to US English with a UTF8 encoding, you w...
[ "Context", "manager", "for", "temporarily", "setting", "a", "locale", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/_config/localization.py#L15-L44
[ "def", "set_locale", "(", "new_locale", ",", "lc_var", "=", "locale", ".", "LC_ALL", ")", ":", "current_locale", "=", "locale", ".", "getlocale", "(", ")", "try", ":", "locale", ".", "setlocale", "(", "lc_var", ",", "new_locale", ")", "normalized_locale", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
can_set_locale
Check to see if we can set a locale, and subsequently get the locale, without raising an Exception. Parameters ---------- lc : str The locale to attempt to set. lc_var : int, default `locale.LC_ALL` The category of the locale being set. Returns ------- is_valid : bool ...
pandas/_config/localization.py
def can_set_locale(lc, lc_var=locale.LC_ALL): """ Check to see if we can set a locale, and subsequently get the locale, without raising an Exception. Parameters ---------- lc : str The locale to attempt to set. lc_var : int, default `locale.LC_ALL` The category of the locale...
def can_set_locale(lc, lc_var=locale.LC_ALL): """ Check to see if we can set a locale, and subsequently get the locale, without raising an Exception. Parameters ---------- lc : str The locale to attempt to set. lc_var : int, default `locale.LC_ALL` The category of the locale...
[ "Check", "to", "see", "if", "we", "can", "set", "a", "locale", "and", "subsequently", "get", "the", "locale", "without", "raising", "an", "Exception", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/_config/localization.py#L47-L72
[ "def", "can_set_locale", "(", "lc", ",", "lc_var", "=", "locale", ".", "LC_ALL", ")", ":", "try", ":", "with", "set_locale", "(", "lc", ",", "lc_var", "=", "lc_var", ")", ":", "pass", "except", "(", "ValueError", ",", "locale", ".", "Error", ")", ":"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_valid_locales
Return a list of normalized locales that do not throw an ``Exception`` when set. Parameters ---------- locales : str A string where each locale is separated by a newline. normalize : bool Whether to call ``locale.normalize`` on each locale. Returns ------- valid_locales...
pandas/_config/localization.py
def _valid_locales(locales, normalize): """ Return a list of normalized locales that do not throw an ``Exception`` when set. Parameters ---------- locales : str A string where each locale is separated by a newline. normalize : bool Whether to call ``locale.normalize`` on eac...
def _valid_locales(locales, normalize): """ Return a list of normalized locales that do not throw an ``Exception`` when set. Parameters ---------- locales : str A string where each locale is separated by a newline. normalize : bool Whether to call ``locale.normalize`` on eac...
[ "Return", "a", "list", "of", "normalized", "locales", "that", "do", "not", "throw", "an", "Exception", "when", "set", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/_config/localization.py#L75-L97
[ "def", "_valid_locales", "(", "locales", ",", "normalize", ")", ":", "if", "normalize", ":", "normalizer", "=", "lambda", "x", ":", "locale", ".", "normalize", "(", "x", ".", "strip", "(", ")", ")", "else", ":", "normalizer", "=", "lambda", "x", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
get_locales
Get all the locales that are available on the system. Parameters ---------- prefix : str If not ``None`` then return only those locales with the prefix provided. For example to get all English language locales (those that start with ``"en"``), pass ``prefix="en"``. normalize : b...
pandas/_config/localization.py
def get_locales(prefix=None, normalize=True, locale_getter=_default_locale_getter): """ Get all the locales that are available on the system. Parameters ---------- prefix : str If not ``None`` then return only those locales with the prefix provided. For example to ge...
def get_locales(prefix=None, normalize=True, locale_getter=_default_locale_getter): """ Get all the locales that are available on the system. Parameters ---------- prefix : str If not ``None`` then return only those locales with the prefix provided. For example to ge...
[ "Get", "all", "the", "locales", "that", "are", "available", "on", "the", "system", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/_config/localization.py#L109-L162
[ "def", "get_locales", "(", "prefix", "=", "None", ",", "normalize", "=", "True", ",", "locale_getter", "=", "_default_locale_getter", ")", ":", "try", ":", "raw_locales", "=", "locale_getter", "(", ")", "except", "Exception", ":", "return", "None", "try", ":...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ensure_float
Ensure that an array object has a float dtype if possible. Parameters ---------- arr : array-like The array whose data type we want to enforce as float. Returns ------- float_arr : The original array cast to the float dtype if possible. Otherwise, the original array is ...
pandas/core/dtypes/common.py
def ensure_float(arr): """ Ensure that an array object has a float dtype if possible. Parameters ---------- arr : array-like The array whose data type we want to enforce as float. Returns ------- float_arr : The original array cast to the float dtype if possible...
def ensure_float(arr): """ Ensure that an array object has a float dtype if possible. Parameters ---------- arr : array-like The array whose data type we want to enforce as float. Returns ------- float_arr : The original array cast to the float dtype if possible...
[ "Ensure", "that", "an", "array", "object", "has", "a", "float", "dtype", "if", "possible", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L40-L57
[ "def", "ensure_float", "(", "arr", ")", ":", "if", "issubclass", "(", "arr", ".", "dtype", ".", "type", ",", "(", "np", ".", "integer", ",", "np", ".", "bool_", ")", ")", ":", "arr", "=", "arr", ".", "astype", "(", "float", ")", "return", "arr" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ensure_categorical
Ensure that an array-like object is a Categorical (if not already). Parameters ---------- arr : array-like The array that we want to convert into a Categorical. Returns ------- cat_arr : The original array cast as a Categorical. If it already is a Categorical, we return a...
pandas/core/dtypes/common.py
def ensure_categorical(arr): """ Ensure that an array-like object is a Categorical (if not already). Parameters ---------- arr : array-like The array that we want to convert into a Categorical. Returns ------- cat_arr : The original array cast as a Categorical. If it already ...
def ensure_categorical(arr): """ Ensure that an array-like object is a Categorical (if not already). Parameters ---------- arr : array-like The array that we want to convert into a Categorical. Returns ------- cat_arr : The original array cast as a Categorical. If it already ...
[ "Ensure", "that", "an", "array", "-", "like", "object", "is", "a", "Categorical", "(", "if", "not", "already", ")", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L69-L87
[ "def", "ensure_categorical", "(", "arr", ")", ":", "if", "not", "is_categorical", "(", "arr", ")", ":", "from", "pandas", "import", "Categorical", "arr", "=", "Categorical", "(", "arr", ")", "return", "arr" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
ensure_int64_or_float64
Ensure that an dtype array of some integer dtype has an int64 dtype if possible If it's not possible, potentially because of overflow, convert the array to float64 instead. Parameters ---------- arr : array-like The array whose data type we want to enforce. copy: boolean ...
pandas/core/dtypes/common.py
def ensure_int64_or_float64(arr, copy=False): """ Ensure that an dtype array of some integer dtype has an int64 dtype if possible If it's not possible, potentially because of overflow, convert the array to float64 instead. Parameters ---------- arr : array-like The array whose...
def ensure_int64_or_float64(arr, copy=False): """ Ensure that an dtype array of some integer dtype has an int64 dtype if possible If it's not possible, potentially because of overflow, convert the array to float64 instead. Parameters ---------- arr : array-like The array whose...
[ "Ensure", "that", "an", "dtype", "array", "of", "some", "integer", "dtype", "has", "an", "int64", "dtype", "if", "possible", "If", "it", "s", "not", "possible", "potentially", "because", "of", "overflow", "convert", "the", "array", "to", "float64", "instead"...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L90-L114
[ "def", "ensure_int64_or_float64", "(", "arr", ",", "copy", "=", "False", ")", ":", "try", ":", "return", "arr", ".", "astype", "(", "'int64'", ",", "copy", "=", "copy", ",", "casting", "=", "'safe'", ")", "except", "TypeError", ":", "return", "arr", "....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
classes_and_not_datetimelike
evaluate if the tipo is a subclass of the klasses and not a datetimelike
pandas/core/dtypes/common.py
def classes_and_not_datetimelike(*klasses): """ evaluate if the tipo is a subclass of the klasses and not a datetimelike """ return lambda tipo: (issubclass(tipo, klasses) and not issubclass(tipo, (np.datetime64, np.timedelta64)))
def classes_and_not_datetimelike(*klasses): """ evaluate if the tipo is a subclass of the klasses and not a datetimelike """ return lambda tipo: (issubclass(tipo, klasses) and not issubclass(tipo, (np.datetime64, np.timedelta64)))
[ "evaluate", "if", "the", "tipo", "is", "a", "subclass", "of", "the", "klasses", "and", "not", "a", "datetimelike" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L122-L128
[ "def", "classes_and_not_datetimelike", "(", "*", "klasses", ")", ":", "return", "lambda", "tipo", ":", "(", "issubclass", "(", "tipo", ",", "klasses", ")", "and", "not", "issubclass", "(", "tipo", ",", "(", "np", ".", "datetime64", ",", "np", ".", "timed...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_sparse
Check whether an array-like is a 1-D pandas sparse array. Check that the one-dimensional array-like is a pandas sparse array. Returns True if it is a pandas sparse array, not another type of sparse array. Parameters ---------- arr : array-like Array-like to check. Returns ----...
pandas/core/dtypes/common.py
def is_sparse(arr): """ Check whether an array-like is a 1-D pandas sparse array. Check that the one-dimensional array-like is a pandas sparse array. Returns True if it is a pandas sparse array, not another type of sparse array. Parameters ---------- arr : array-like Array-like...
def is_sparse(arr): """ Check whether an array-like is a 1-D pandas sparse array. Check that the one-dimensional array-like is a pandas sparse array. Returns True if it is a pandas sparse array, not another type of sparse array. Parameters ---------- arr : array-like Array-like...
[ "Check", "whether", "an", "array", "-", "like", "is", "a", "1", "-", "D", "pandas", "sparse", "array", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L161-L220
[ "def", "is_sparse", "(", "arr", ")", ":", "from", "pandas", ".", "core", ".", "arrays", ".", "sparse", "import", "SparseDtype", "dtype", "=", "getattr", "(", "arr", ",", "'dtype'", ",", "arr", ")", "return", "isinstance", "(", "dtype", ",", "SparseDtype"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_scipy_sparse
Check whether an array-like is a scipy.sparse.spmatrix instance. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a scipy.sparse.spmatrix instance. Notes ----- If scipy is not installed, this f...
pandas/core/dtypes/common.py
def is_scipy_sparse(arr): """ Check whether an array-like is a scipy.sparse.spmatrix instance. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a scipy.sparse.spmatrix instance. Notes -----...
def is_scipy_sparse(arr): """ Check whether an array-like is a scipy.sparse.spmatrix instance. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a scipy.sparse.spmatrix instance. Notes -----...
[ "Check", "whether", "an", "array", "-", "like", "is", "a", "scipy", ".", "sparse", ".", "spmatrix", "instance", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L223-L260
[ "def", "is_scipy_sparse", "(", "arr", ")", ":", "global", "_is_scipy_sparse", "if", "_is_scipy_sparse", "is", "None", ":", "try", ":", "from", "scipy", ".", "sparse", "import", "issparse", "as", "_is_scipy_sparse", "except", "ImportError", ":", "_is_scipy_sparse",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_offsetlike
Check if obj or all elements of list-like is DateOffset Parameters ---------- arr_or_obj : object Returns ------- boolean Whether the object is a DateOffset or listlike of DatetOffsets Examples -------- >>> is_offsetlike(pd.DateOffset(days=1)) True >>> is_offsetlik...
pandas/core/dtypes/common.py
def is_offsetlike(arr_or_obj): """ Check if obj or all elements of list-like is DateOffset Parameters ---------- arr_or_obj : object Returns ------- boolean Whether the object is a DateOffset or listlike of DatetOffsets Examples -------- >>> is_offsetlike(pd.DateOf...
def is_offsetlike(arr_or_obj): """ Check if obj or all elements of list-like is DateOffset Parameters ---------- arr_or_obj : object Returns ------- boolean Whether the object is a DateOffset or listlike of DatetOffsets Examples -------- >>> is_offsetlike(pd.DateOf...
[ "Check", "if", "obj", "or", "all", "elements", "of", "list", "-", "like", "is", "DateOffset" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L343-L372
[ "def", "is_offsetlike", "(", "arr_or_obj", ")", ":", "if", "isinstance", "(", "arr_or_obj", ",", "ABCDateOffset", ")", ":", "return", "True", "elif", "(", "is_list_like", "(", "arr_or_obj", ")", "and", "len", "(", "arr_or_obj", ")", "and", "is_object_dtype", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_period
Check whether an array-like is a periodical index. .. deprecated:: 0.24.0 Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical index. Examples -------- >>> is_period([1, 2, 3]) ...
pandas/core/dtypes/common.py
def is_period(arr): """ Check whether an array-like is a periodical index. .. deprecated:: 0.24.0 Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical index. Examples --------...
def is_period(arr): """ Check whether an array-like is a periodical index. .. deprecated:: 0.24.0 Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical index. Examples --------...
[ "Check", "whether", "an", "array", "-", "like", "is", "a", "periodical", "index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L375-L405
[ "def", "is_period", "(", "arr", ")", ":", "warnings", ".", "warn", "(", "\"'is_period' is deprecated and will be removed in a future \"", "\"version. Use 'is_period_dtype' or is_period_arraylike' \"", "\"instead.\"", ",", "FutureWarning", ",", "stacklevel", "=", "2", ")", "r...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_string_dtype
Check whether the provided array or dtype is of the string dtype. Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the string dtype. Examples -------- >>> is_string_dtype(st...
pandas/core/dtypes/common.py
def is_string_dtype(arr_or_dtype): """ Check whether the provided array or dtype is of the string dtype. Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the string dtype. E...
def is_string_dtype(arr_or_dtype): """ Check whether the provided array or dtype is of the string dtype. Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the string dtype. E...
[ "Check", "whether", "the", "provided", "array", "or", "dtype", "is", "of", "the", "string", "dtype", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L611-L643
[ "def", "is_string_dtype", "(", "arr_or_dtype", ")", ":", "# TODO: gh-15585: consider making the checks stricter.", "def", "condition", "(", "dtype", ")", ":", "return", "dtype", ".", "kind", "in", "(", "'O'", ",", "'S'", ",", "'U'", ")", "and", "not", "is_period...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_period_arraylike
Check whether an array-like is a periodical array-like or PeriodIndex. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical array-like or PeriodIndex instance. Examples -------- ...
pandas/core/dtypes/common.py
def is_period_arraylike(arr): """ Check whether an array-like is a periodical array-like or PeriodIndex. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical array-like or PeriodInd...
def is_period_arraylike(arr): """ Check whether an array-like is a periodical array-like or PeriodIndex. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical array-like or PeriodInd...
[ "Check", "whether", "an", "array", "-", "like", "is", "a", "periodical", "array", "-", "like", "or", "PeriodIndex", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L646-L675
[ "def", "is_period_arraylike", "(", "arr", ")", ":", "if", "isinstance", "(", "arr", ",", "(", "ABCPeriodIndex", ",", "ABCPeriodArray", ")", ")", ":", "return", "True", "elif", "isinstance", "(", "arr", ",", "(", "np", ".", "ndarray", ",", "ABCSeries", ")...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_datetime_arraylike
Check whether an array-like is a datetime array-like or DatetimeIndex. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a datetime array-like or DatetimeIndex. Examples -------- >>> is_...
pandas/core/dtypes/common.py
def is_datetime_arraylike(arr): """ Check whether an array-like is a datetime array-like or DatetimeIndex. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a datetime array-like or DatetimeI...
def is_datetime_arraylike(arr): """ Check whether an array-like is a datetime array-like or DatetimeIndex. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a datetime array-like or DatetimeI...
[ "Check", "whether", "an", "array", "-", "like", "is", "a", "datetime", "array", "-", "like", "or", "DatetimeIndex", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L678-L708
[ "def", "is_datetime_arraylike", "(", "arr", ")", ":", "if", "isinstance", "(", "arr", ",", "ABCDatetimeIndex", ")", ":", "return", "True", "elif", "isinstance", "(", "arr", ",", "(", "np", ".", "ndarray", ",", "ABCSeries", ")", ")", ":", "return", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_datetimelike
Check whether an array-like is a datetime-like array-like. Acceptable datetime-like objects are (but not limited to) datetime indices, periodic indices, and timedelta indices. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Wheth...
pandas/core/dtypes/common.py
def is_datetimelike(arr): """ Check whether an array-like is a datetime-like array-like. Acceptable datetime-like objects are (but not limited to) datetime indices, periodic indices, and timedelta indices. Parameters ---------- arr : array-like The array-like to check. Returns...
def is_datetimelike(arr): """ Check whether an array-like is a datetime-like array-like. Acceptable datetime-like objects are (but not limited to) datetime indices, periodic indices, and timedelta indices. Parameters ---------- arr : array-like The array-like to check. Returns...
[ "Check", "whether", "an", "array", "-", "like", "is", "a", "datetime", "-", "like", "array", "-", "like", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L711-L753
[ "def", "is_datetimelike", "(", "arr", ")", ":", "return", "(", "is_datetime64_dtype", "(", "arr", ")", "or", "is_datetime64tz_dtype", "(", "arr", ")", "or", "is_timedelta64_dtype", "(", "arr", ")", "or", "isinstance", "(", "arr", ",", "ABCPeriodIndex", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_dtype_equal
Check if two dtypes are equal. Parameters ---------- source : The first dtype to compare target : The second dtype to compare Returns ---------- boolean Whether or not the two dtypes are equal. Examples -------- >>> is_dtype_equal(int, float) False >>> is_dtype...
pandas/core/dtypes/common.py
def is_dtype_equal(source, target): """ Check if two dtypes are equal. Parameters ---------- source : The first dtype to compare target : The second dtype to compare Returns ---------- boolean Whether or not the two dtypes are equal. Examples -------- >>> is_dt...
def is_dtype_equal(source, target): """ Check if two dtypes are equal. Parameters ---------- source : The first dtype to compare target : The second dtype to compare Returns ---------- boolean Whether or not the two dtypes are equal. Examples -------- >>> is_dt...
[ "Check", "if", "two", "dtypes", "are", "equal", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L756-L792
[ "def", "is_dtype_equal", "(", "source", ",", "target", ")", ":", "try", ":", "source", "=", "_get_dtype", "(", "source", ")", "target", "=", "_get_dtype", "(", "target", ")", "return", "source", "==", "target", "except", "(", "TypeError", ",", "AttributeEr...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_dtype_union_equal
Check whether two arrays have compatible dtypes to do a union. numpy types are checked with ``is_dtype_equal``. Extension types are checked separately. Parameters ---------- source : The first dtype to compare target : The second dtype to compare Returns ---------- boolean ...
pandas/core/dtypes/common.py
def is_dtype_union_equal(source, target): """ Check whether two arrays have compatible dtypes to do a union. numpy types are checked with ``is_dtype_equal``. Extension types are checked separately. Parameters ---------- source : The first dtype to compare target : The second dtype to co...
def is_dtype_union_equal(source, target): """ Check whether two arrays have compatible dtypes to do a union. numpy types are checked with ``is_dtype_equal``. Extension types are checked separately. Parameters ---------- source : The first dtype to compare target : The second dtype to co...
[ "Check", "whether", "two", "arrays", "have", "compatible", "dtypes", "to", "do", "a", "union", ".", "numpy", "types", "are", "checked", "with", "is_dtype_equal", ".", "Extension", "types", "are", "checked", "separately", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L795-L827
[ "def", "is_dtype_union_equal", "(", "source", ",", "target", ")", ":", "source", "=", "_get_dtype", "(", "source", ")", "target", "=", "_get_dtype", "(", "target", ")", "if", "is_categorical_dtype", "(", "source", ")", "and", "is_categorical_dtype", "(", "targ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_datetime64_ns_dtype
Check whether the provided array or dtype is of the datetime64[ns] dtype. Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the datetime64[ns] dtype. Examples -------- >>> is...
pandas/core/dtypes/common.py
def is_datetime64_ns_dtype(arr_or_dtype): """ Check whether the provided array or dtype is of the datetime64[ns] dtype. Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the datet...
def is_datetime64_ns_dtype(arr_or_dtype): """ Check whether the provided array or dtype is of the datetime64[ns] dtype. Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean Whether or not the array or dtype is of the datet...
[ "Check", "whether", "the", "provided", "array", "or", "dtype", "is", "of", "the", "datetime64", "[", "ns", "]", "dtype", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L1135-L1182
[ "def", "is_datetime64_ns_dtype", "(", "arr_or_dtype", ")", ":", "if", "arr_or_dtype", "is", "None", ":", "return", "False", "try", ":", "tipo", "=", "_get_dtype", "(", "arr_or_dtype", ")", "except", "TypeError", ":", "if", "is_datetime64tz_dtype", "(", "arr_or_d...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_numeric_v_string_like
Check if we are comparing a string-like object to a numeric ndarray. NumPy doesn't like to compare such objects, especially numeric arrays and scalar string-likes. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object t...
pandas/core/dtypes/common.py
def is_numeric_v_string_like(a, b): """ Check if we are comparing a string-like object to a numeric ndarray. NumPy doesn't like to compare such objects, especially numeric arrays and scalar string-likes. Parameters ---------- a : array-like, scalar The first object to check. b ...
def is_numeric_v_string_like(a, b): """ Check if we are comparing a string-like object to a numeric ndarray. NumPy doesn't like to compare such objects, especially numeric arrays and scalar string-likes. Parameters ---------- a : array-like, scalar The first object to check. b ...
[ "Check", "if", "we", "are", "comparing", "a", "string", "-", "like", "object", "to", "a", "numeric", "ndarray", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L1280-L1335
[ "def", "is_numeric_v_string_like", "(", "a", ",", "b", ")", ":", "is_a_array", "=", "isinstance", "(", "a", ",", "np", ".", "ndarray", ")", "is_b_array", "=", "isinstance", "(", "b", ",", "np", ".", "ndarray", ")", "is_a_numeric_array", "=", "is_a_array", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_datetimelike_v_numeric
Check if we are comparing a datetime-like object to a numeric object. By "numeric," we mean an object that is either of an int or float dtype. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. Returns ...
pandas/core/dtypes/common.py
def is_datetimelike_v_numeric(a, b): """ Check if we are comparing a datetime-like object to a numeric object. By "numeric," we mean an object that is either of an int or float dtype. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar ...
def is_datetimelike_v_numeric(a, b): """ Check if we are comparing a datetime-like object to a numeric object. By "numeric," we mean an object that is either of an int or float dtype. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar ...
[ "Check", "if", "we", "are", "comparing", "a", "datetime", "-", "like", "object", "to", "a", "numeric", "object", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L1338-L1393
[ "def", "is_datetimelike_v_numeric", "(", "a", ",", "b", ")", ":", "if", "not", "hasattr", "(", "a", ",", "'dtype'", ")", ":", "a", "=", "np", ".", "asarray", "(", "a", ")", "if", "not", "hasattr", "(", "b", ",", "'dtype'", ")", ":", "b", "=", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_datetimelike_v_object
Check if we are comparing a datetime-like object to an object instance. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. Returns ------- boolean Whether we return a comparing a datetime-like t...
pandas/core/dtypes/common.py
def is_datetimelike_v_object(a, b): """ Check if we are comparing a datetime-like object to an object instance. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. Returns ------- boolean ...
def is_datetimelike_v_object(a, b): """ Check if we are comparing a datetime-like object to an object instance. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. Returns ------- boolean ...
[ "Check", "if", "we", "are", "comparing", "a", "datetime", "-", "like", "object", "to", "an", "object", "instance", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L1396-L1446
[ "def", "is_datetimelike_v_object", "(", "a", ",", "b", ")", ":", "if", "not", "hasattr", "(", "a", ",", "'dtype'", ")", ":", "a", "=", "np", ".", "asarray", "(", "a", ")", "if", "not", "hasattr", "(", "b", ",", "'dtype'", ")", ":", "b", "=", "n...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
needs_i8_conversion
Check whether the array or dtype should be converted to int64. An array-like or dtype "needs" such a conversion if the array-like or dtype is of a datetime-like dtype Parameters ---------- arr_or_dtype : array-like The array or dtype to check. Returns ------- boolean W...
pandas/core/dtypes/common.py
def needs_i8_conversion(arr_or_dtype): """ Check whether the array or dtype should be converted to int64. An array-like or dtype "needs" such a conversion if the array-like or dtype is of a datetime-like dtype Parameters ---------- arr_or_dtype : array-like The array or dtype to ch...
def needs_i8_conversion(arr_or_dtype): """ Check whether the array or dtype should be converted to int64. An array-like or dtype "needs" such a conversion if the array-like or dtype is of a datetime-like dtype Parameters ---------- arr_or_dtype : array-like The array or dtype to ch...
[ "Check", "whether", "the", "array", "or", "dtype", "should", "be", "converted", "to", "int64", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/common.py#L1449-L1488
[ "def", "needs_i8_conversion", "(", "arr_or_dtype", ")", ":", "if", "arr_or_dtype", "is", "None", ":", "return", "False", "return", "(", "is_datetime_or_timedelta_dtype", "(", "arr_or_dtype", ")", "or", "is_datetime64tz_dtype", "(", "arr_or_dtype", ")", "or", "is_per...
9feb3ad92cc0397a04b665803a49299ee7aa1037