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
DatetimeLikeArrayMixin.repeat
Repeat elements of an array. See Also -------- numpy.ndarray.repeat
pandas/core/arrays/datetimelike.py
def repeat(self, repeats, *args, **kwargs): """ Repeat elements of an array. See Also -------- numpy.ndarray.repeat """ nv.validate_repeat(args, kwargs) values = self._data.repeat(repeats) return type(self)(values.view('i8'), dtype=self.dtype)
def repeat(self, repeats, *args, **kwargs): """ Repeat elements of an array. See Also -------- numpy.ndarray.repeat """ nv.validate_repeat(args, kwargs) values = self._data.repeat(repeats) return type(self)(values.view('i8'), dtype=self.dtype)
[ "Repeat", "elements", "of", "an", "array", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L668-L678
[ "def", "repeat", "(", "self", ",", "repeats", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_repeat", "(", "args", ",", "kwargs", ")", "values", "=", "self", ".", "_data", ".", "repeat", "(", "repeats", ")", "return", "ty...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin.value_counts
Return a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaT values. Returns ------- Series
pandas/core/arrays/datetimelike.py
def value_counts(self, dropna=False): """ Return a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaT values. Returns ------- Series """ from pandas impo...
def value_counts(self, dropna=False): """ Return a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaT values. Returns ------- Series """ from pandas impo...
[ "Return", "a", "Series", "containing", "counts", "of", "unique", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L680-L705
[ "def", "value_counts", "(", "self", ",", "dropna", "=", "False", ")", ":", "from", "pandas", "import", "Series", ",", "Index", "if", "dropna", ":", "values", "=", "self", "[", "~", "self", ".", "isna", "(", ")", "]", ".", "_data", "else", ":", "val...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._maybe_mask_results
Parameters ---------- result : a ndarray fill_value : object, default iNaT convert : string/dtype or None Returns ------- result : ndarray with values replace by the fill_value mask the result if needed, convert to the provided dtype if its not N...
pandas/core/arrays/datetimelike.py
def _maybe_mask_results(self, result, fill_value=iNaT, convert=None): """ Parameters ---------- result : a ndarray fill_value : object, default iNaT convert : string/dtype or None Returns ------- result : ndarray with values replace by the fill_va...
def _maybe_mask_results(self, result, fill_value=iNaT, convert=None): """ Parameters ---------- result : a ndarray fill_value : object, default iNaT convert : string/dtype or None Returns ------- result : ndarray with values replace by the fill_va...
[ "Parameters", "----------", "result", ":", "a", "ndarray", "fill_value", ":", "object", "default", "iNaT", "convert", ":", "string", "/", "dtype", "or", "None" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L737-L761
[ "def", "_maybe_mask_results", "(", "self", ",", "result", ",", "fill_value", "=", "iNaT", ",", "convert", "=", "None", ")", ":", "if", "self", ".", "_hasnans", ":", "if", "convert", ":", "result", "=", "result", ".", "astype", "(", "convert", ")", "if"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._validate_frequency
Validate that a frequency is compatible with the values of a given Datetime Array/Index or Timedelta Array/Index Parameters ---------- index : DatetimeIndex or TimedeltaIndex The index on which to determine if the given frequency is valid freq : DateOffset ...
pandas/core/arrays/datetimelike.py
def _validate_frequency(cls, index, freq, **kwargs): """ Validate that a frequency is compatible with the values of a given Datetime Array/Index or Timedelta Array/Index Parameters ---------- index : DatetimeIndex or TimedeltaIndex The index on which to deter...
def _validate_frequency(cls, index, freq, **kwargs): """ Validate that a frequency is compatible with the values of a given Datetime Array/Index or Timedelta Array/Index Parameters ---------- index : DatetimeIndex or TimedeltaIndex The index on which to deter...
[ "Validate", "that", "a", "frequency", "is", "compatible", "with", "the", "values", "of", "a", "given", "Datetime", "Array", "/", "Index", "or", "Timedelta", "Array", "/", "Index" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L860-L898
[ "def", "_validate_frequency", "(", "cls", ",", "index", ",", "freq", ",", "*", "*", "kwargs", ")", ":", "if", "is_period_dtype", "(", "cls", ")", ":", "# Frequency validation is not meaningful for Period Array/Index", "return", "None", "inferred", "=", "index", "....
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._add_delta
Add a timedelta-like, Tick or TimedeltaIndex-like object to self, yielding an int64 numpy array Parameters ---------- delta : {timedelta, np.timedelta64, Tick, TimedeltaIndex, ndarray[timedelta64]} Returns ------- result : ndarray[int64] ...
pandas/core/arrays/datetimelike.py
def _add_delta(self, other): """ Add a timedelta-like, Tick or TimedeltaIndex-like object to self, yielding an int64 numpy array Parameters ---------- delta : {timedelta, np.timedelta64, Tick, TimedeltaIndex, ndarray[timedelta64]} Returns ...
def _add_delta(self, other): """ Add a timedelta-like, Tick or TimedeltaIndex-like object to self, yielding an int64 numpy array Parameters ---------- delta : {timedelta, np.timedelta64, Tick, TimedeltaIndex, ndarray[timedelta64]} Returns ...
[ "Add", "a", "timedelta", "-", "like", "Tick", "or", "TimedeltaIndex", "-", "like", "object", "to", "self", "yielding", "an", "int64", "numpy", "array" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L942-L967
[ "def", "_add_delta", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "(", "Tick", ",", "timedelta", ",", "np", ".", "timedelta64", ")", ")", ":", "new_values", "=", "self", ".", "_add_timedeltalike_scalar", "(", "other", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._add_timedeltalike_scalar
Add a delta of a timedeltalike return the i8 result view
pandas/core/arrays/datetimelike.py
def _add_timedeltalike_scalar(self, other): """ Add a delta of a timedeltalike return the i8 result view """ if isna(other): # i.e np.timedelta64("NaT"), not recognized by delta_to_nanoseconds new_values = np.empty(len(self), dtype='i8') new_va...
def _add_timedeltalike_scalar(self, other): """ Add a delta of a timedeltalike return the i8 result view """ if isna(other): # i.e np.timedelta64("NaT"), not recognized by delta_to_nanoseconds new_values = np.empty(len(self), dtype='i8') new_va...
[ "Add", "a", "delta", "of", "a", "timedeltalike", "return", "the", "i8", "result", "view" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L969-L984
[ "def", "_add_timedeltalike_scalar", "(", "self", ",", "other", ")", ":", "if", "isna", "(", "other", ")", ":", "# i.e np.timedelta64(\"NaT\"), not recognized by delta_to_nanoseconds", "new_values", "=", "np", ".", "empty", "(", "len", "(", "self", ")", ",", "dtype...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._add_delta_tdi
Add a delta of a TimedeltaIndex return the i8 result view
pandas/core/arrays/datetimelike.py
def _add_delta_tdi(self, other): """ Add a delta of a TimedeltaIndex return the i8 result view """ if len(self) != len(other): raise ValueError("cannot add indices of unequal length") if isinstance(other, np.ndarray): # ndarray[timedelta64]; wrap ...
def _add_delta_tdi(self, other): """ Add a delta of a TimedeltaIndex return the i8 result view """ if len(self) != len(other): raise ValueError("cannot add indices of unequal length") if isinstance(other, np.ndarray): # ndarray[timedelta64]; wrap ...
[ "Add", "a", "delta", "of", "a", "TimedeltaIndex", "return", "the", "i8", "result", "view" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L986-L1007
[ "def", "_add_delta_tdi", "(", "self", ",", "other", ")", ":", "if", "len", "(", "self", ")", "!=", "len", "(", "other", ")", ":", "raise", "ValueError", "(", "\"cannot add indices of unequal length\"", ")", "if", "isinstance", "(", "other", ",", "np", ".",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._add_nat
Add pd.NaT to self
pandas/core/arrays/datetimelike.py
def _add_nat(self): """ Add pd.NaT to self """ if is_period_dtype(self): raise TypeError('Cannot add {cls} and {typ}' .format(cls=type(self).__name__, typ=type(NaT).__name__)) # GH#19124 pd.NaT is treate...
def _add_nat(self): """ Add pd.NaT to self """ if is_period_dtype(self): raise TypeError('Cannot add {cls} and {typ}' .format(cls=type(self).__name__, typ=type(NaT).__name__)) # GH#19124 pd.NaT is treate...
[ "Add", "pd", ".", "NaT", "to", "self" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1009-L1022
[ "def", "_add_nat", "(", "self", ")", ":", "if", "is_period_dtype", "(", "self", ")", ":", "raise", "TypeError", "(", "'Cannot add {cls} and {typ}'", ".", "format", "(", "cls", "=", "type", "(", "self", ")", ".", "__name__", ",", "typ", "=", "type", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._sub_nat
Subtract pd.NaT from self
pandas/core/arrays/datetimelike.py
def _sub_nat(self): """ Subtract pd.NaT from self """ # GH#19124 Timedelta - datetime is not in general well-defined. # We make an exception for pd.NaT, which in this case quacks # like a timedelta. # For datetime64 dtypes by convention we treat NaT as a datetime,...
def _sub_nat(self): """ Subtract pd.NaT from self """ # GH#19124 Timedelta - datetime is not in general well-defined. # We make an exception for pd.NaT, which in this case quacks # like a timedelta. # For datetime64 dtypes by convention we treat NaT as a datetime,...
[ "Subtract", "pd", ".", "NaT", "from", "self" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1024-L1036
[ "def", "_sub_nat", "(", "self", ")", ":", "# GH#19124 Timedelta - datetime is not in general well-defined.", "# We make an exception for pd.NaT, which in this case quacks", "# like a timedelta.", "# For datetime64 dtypes by convention we treat NaT as a datetime, so", "# this subtraction returns ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._sub_period_array
Subtract a Period Array/Index from self. This is only valid if self is itself a Period Array/Index, raises otherwise. Both objects must have the same frequency. Parameters ---------- other : PeriodIndex or PeriodArray Returns ------- result : np.ndarra...
pandas/core/arrays/datetimelike.py
def _sub_period_array(self, other): """ Subtract a Period Array/Index from self. This is only valid if self is itself a Period Array/Index, raises otherwise. Both objects must have the same frequency. Parameters ---------- other : PeriodIndex or PeriodArray ...
def _sub_period_array(self, other): """ Subtract a Period Array/Index from self. This is only valid if self is itself a Period Array/Index, raises otherwise. Both objects must have the same frequency. Parameters ---------- other : PeriodIndex or PeriodArray ...
[ "Subtract", "a", "Period", "Array", "/", "Index", "from", "self", ".", "This", "is", "only", "valid", "if", "self", "is", "itself", "a", "Period", "Array", "/", "Index", "raises", "otherwise", ".", "Both", "objects", "must", "have", "the", "same", "frequ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1038-L1075
[ "def", "_sub_period_array", "(", "self", ",", "other", ")", ":", "if", "not", "is_period_dtype", "(", "self", ")", ":", "raise", "TypeError", "(", "\"cannot subtract {dtype}-dtype from {cls}\"", ".", "format", "(", "dtype", "=", "other", ".", "dtype", ",", "cl...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._addsub_int_array
Add or subtract array-like of integers equivalent to applying `_time_shift` pointwise. Parameters ---------- other : Index, ExtensionArray, np.ndarray integer-dtype op : {operator.add, operator.sub} Returns ------- result : same class as self
pandas/core/arrays/datetimelike.py
def _addsub_int_array(self, other, op): """ Add or subtract array-like of integers equivalent to applying `_time_shift` pointwise. Parameters ---------- other : Index, ExtensionArray, np.ndarray integer-dtype op : {operator.add, operator.sub} ...
def _addsub_int_array(self, other, op): """ Add or subtract array-like of integers equivalent to applying `_time_shift` pointwise. Parameters ---------- other : Index, ExtensionArray, np.ndarray integer-dtype op : {operator.add, operator.sub} ...
[ "Add", "or", "subtract", "array", "-", "like", "of", "integers", "equivalent", "to", "applying", "_time_shift", "pointwise", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1077-L1108
[ "def", "_addsub_int_array", "(", "self", ",", "other", ",", "op", ")", ":", "# _addsub_int_array is overriden by PeriodArray", "assert", "not", "is_period_dtype", "(", "self", ")", "assert", "op", "in", "[", "operator", ".", "add", ",", "operator", ".", "sub", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._addsub_offset_array
Add or subtract array-like of DateOffset objects Parameters ---------- other : Index, np.ndarray object-dtype containing pd.DateOffset objects op : {operator.add, operator.sub} Returns ------- result : same class as self
pandas/core/arrays/datetimelike.py
def _addsub_offset_array(self, other, op): """ Add or subtract array-like of DateOffset objects Parameters ---------- other : Index, np.ndarray object-dtype containing pd.DateOffset objects op : {operator.add, operator.sub} Returns ------- ...
def _addsub_offset_array(self, other, op): """ Add or subtract array-like of DateOffset objects Parameters ---------- other : Index, np.ndarray object-dtype containing pd.DateOffset objects op : {operator.add, operator.sub} Returns ------- ...
[ "Add", "or", "subtract", "array", "-", "like", "of", "DateOffset", "objects" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1110-L1139
[ "def", "_addsub_offset_array", "(", "self", ",", "other", ",", "op", ")", ":", "assert", "op", "in", "[", "operator", ".", "add", ",", "operator", ".", "sub", "]", "if", "len", "(", "other", ")", "==", "1", ":", "return", "op", "(", "self", ",", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._time_shift
Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int Number of periods to shift by. freq : pandas.DateOf...
pandas/core/arrays/datetimelike.py
def _time_shift(self, periods, freq=None): """ Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int ...
def _time_shift(self, periods, freq=None): """ Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int ...
[ "Shift", "each", "value", "by", "periods", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1141-L1177
[ "def", "_time_shift", "(", "self", ",", "periods", ",", "freq", "=", "None", ")", ":", "if", "freq", "is", "not", "None", "and", "freq", "!=", "self", ".", "freq", ":", "if", "isinstance", "(", "freq", ",", "str", ")", ":", "freq", "=", "frequencie...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin._ensure_localized
Ensure that we are re-localized. This is for compat as we can then call this on all datetimelike arrays generally (ignored for Period/Timedelta) Parameters ---------- arg : Union[DatetimeLikeArray, DatetimeIndexOpsMixin, ndarray] ambiguous : str, bool, or bool-ndarray, ...
pandas/core/arrays/datetimelike.py
def _ensure_localized(self, arg, ambiguous='raise', nonexistent='raise', from_utc=False): """ Ensure that we are re-localized. This is for compat as we can then call this on all datetimelike arrays generally (ignored for Period/Timedelta) Parameters ...
def _ensure_localized(self, arg, ambiguous='raise', nonexistent='raise', from_utc=False): """ Ensure that we are re-localized. This is for compat as we can then call this on all datetimelike arrays generally (ignored for Period/Timedelta) Parameters ...
[ "Ensure", "that", "we", "are", "re", "-", "localized", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1340-L1373
[ "def", "_ensure_localized", "(", "self", ",", "arg", ",", "ambiguous", "=", "'raise'", ",", "nonexistent", "=", "'raise'", ",", "from_utc", "=", "False", ")", ":", "# reconvert to local tz", "tz", "=", "getattr", "(", "self", ",", "'tz'", ",", "None", ")",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin.min
Return the minimum value of the Array or minimum along an axis. See Also -------- numpy.ndarray.min Index.min : Return the minimum value in an Index. Series.min : Return the minimum value in a Series.
pandas/core/arrays/datetimelike.py
def min(self, axis=None, skipna=True, *args, **kwargs): """ Return the minimum value of the Array or minimum along an axis. See Also -------- numpy.ndarray.min Index.min : Return the minimum value in an Index. Series.min : Return the minimum value in a Se...
def min(self, axis=None, skipna=True, *args, **kwargs): """ Return the minimum value of the Array or minimum along an axis. See Also -------- numpy.ndarray.min Index.min : Return the minimum value in an Index. Series.min : Return the minimum value in a Se...
[ "Return", "the", "minimum", "value", "of", "the", "Array", "or", "minimum", "along", "an", "axis", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1385-L1403
[ "def", "min", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_min", "(", "args", ",", "kwargs", ")", "nv", ".", "validate_minmax_axis", "(", "axis", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DatetimeLikeArrayMixin.max
Return the maximum value of the Array or maximum along an axis. See Also -------- numpy.ndarray.max Index.max : Return the maximum value in an Index. Series.max : Return the maximum value in a Series.
pandas/core/arrays/datetimelike.py
def max(self, axis=None, skipna=True, *args, **kwargs): """ Return the maximum value of the Array or maximum along an axis. See Also -------- numpy.ndarray.max Index.max : Return the maximum value in an Index. Series.max : Return the maximum value in a Se...
def max(self, axis=None, skipna=True, *args, **kwargs): """ Return the maximum value of the Array or maximum along an axis. See Also -------- numpy.ndarray.max Index.max : Return the maximum value in an Index. Series.max : Return the maximum value in a Se...
[ "Return", "the", "maximum", "value", "of", "the", "Array", "or", "maximum", "along", "an", "axis", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimelike.py#L1405-L1435
[ "def", "max", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: skipna is broken with max.", "# See https://github.com/pandas-dev/pandas/issues/24265", "nv", ".", "validate_max", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_period_array_cmp
Wrap comparison operations to convert Period-like to PeriodDtype
pandas/core/arrays/period.py
def _period_array_cmp(cls, op): """ Wrap comparison operations to convert Period-like to PeriodDtype """ opname = '__{name}__'.format(name=op.__name__) nat_result = opname == '__ne__' def wrapper(self, other): op = getattr(self.asi8, opname) if isinstance(other, (ABCDataFrame, ...
def _period_array_cmp(cls, op): """ Wrap comparison operations to convert Period-like to PeriodDtype """ opname = '__{name}__'.format(name=op.__name__) nat_result = opname == '__ne__' def wrapper(self, other): op = getattr(self.asi8, opname) if isinstance(other, (ABCDataFrame, ...
[ "Wrap", "comparison", "operations", "to", "convert", "Period", "-", "like", "to", "PeriodDtype" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L44-L86
[ "def", "_period_array_cmp", "(", "cls", ",", "op", ")", ":", "opname", "=", "'__{name}__'", ".", "format", "(", "name", "=", "op", ".", "__name__", ")", "nat_result", "=", "opname", "==", "'__ne__'", "def", "wrapper", "(", "self", ",", "other", ")", ":...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_raise_on_incompatible
Helper function to render a consistent error message when raising IncompatibleFrequency. Parameters ---------- left : PeriodArray right : DateOffset, Period, ndarray, or timedelta-like Raises ------ IncompatibleFrequency
pandas/core/arrays/period.py
def _raise_on_incompatible(left, right): """ Helper function to render a consistent error message when raising IncompatibleFrequency. Parameters ---------- left : PeriodArray right : DateOffset, Period, ndarray, or timedelta-like Raises ------ IncompatibleFrequency """ ...
def _raise_on_incompatible(left, right): """ Helper function to render a consistent error message when raising IncompatibleFrequency. Parameters ---------- left : PeriodArray right : DateOffset, Period, ndarray, or timedelta-like Raises ------ IncompatibleFrequency """ ...
[ "Helper", "function", "to", "render", "a", "consistent", "error", "message", "when", "raising", "IncompatibleFrequency", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L681-L706
[ "def", "_raise_on_incompatible", "(", "left", ",", "right", ")", ":", "# GH#24283 error message format depends on whether right is scalar", "if", "isinstance", "(", "right", ",", "np", ".", "ndarray", ")", ":", "other_freq", "=", "None", "elif", "isinstance", "(", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
period_array
Construct a new PeriodArray from a sequence of Period scalars. Parameters ---------- data : Sequence of Period objects A sequence of Period objects. These are required to all have the same ``freq.`` Missing values can be indicated by ``None`` or ``pandas.NaT``. freq : str, Tick,...
pandas/core/arrays/period.py
def period_array( data: Sequence[Optional[Period]], freq: Optional[Tick] = None, copy: bool = False, ) -> PeriodArray: """ Construct a new PeriodArray from a sequence of Period scalars. Parameters ---------- data : Sequence of Period objects A sequence of Period obje...
def period_array( data: Sequence[Optional[Period]], freq: Optional[Tick] = None, copy: bool = False, ) -> PeriodArray: """ Construct a new PeriodArray from a sequence of Period scalars. Parameters ---------- data : Sequence of Period objects A sequence of Period obje...
[ "Construct", "a", "new", "PeriodArray", "from", "a", "sequence", "of", "Period", "scalars", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L712-L791
[ "def", "period_array", "(", "data", ":", "Sequence", "[", "Optional", "[", "Period", "]", "]", ",", "freq", ":", "Optional", "[", "Tick", "]", "=", "None", ",", "copy", ":", "bool", "=", "False", ",", ")", "->", "PeriodArray", ":", "if", "is_datetime...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
validate_dtype_freq
If both a dtype and a freq are available, ensure they match. If only dtype is available, extract the implied freq. Parameters ---------- dtype : dtype freq : DateOffset or None Returns ------- freq : DateOffset Raises ------ ValueError : non-period dtype IncompatibleF...
pandas/core/arrays/period.py
def validate_dtype_freq(dtype, freq): """ If both a dtype and a freq are available, ensure they match. If only dtype is available, extract the implied freq. Parameters ---------- dtype : dtype freq : DateOffset or None Returns ------- freq : DateOffset Raises ------ ...
def validate_dtype_freq(dtype, freq): """ If both a dtype and a freq are available, ensure they match. If only dtype is available, extract the implied freq. Parameters ---------- dtype : dtype freq : DateOffset or None Returns ------- freq : DateOffset Raises ------ ...
[ "If", "both", "a", "dtype", "and", "a", "freq", "are", "available", "ensure", "they", "match", ".", "If", "only", "dtype", "is", "available", "extract", "the", "implied", "freq", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L794-L825
[ "def", "validate_dtype_freq", "(", "dtype", ",", "freq", ")", ":", "if", "freq", "is", "not", "None", ":", "freq", "=", "frequencies", ".", "to_offset", "(", "freq", ")", "if", "dtype", "is", "not", "None", ":", "dtype", "=", "pandas_dtype", "(", "dtyp...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
dt64arr_to_periodarr
Convert an datetime-like array to values Period ordinals. Parameters ---------- data : Union[Series[datetime64[ns]], DatetimeIndex, ndarray[datetime64ns]] freq : Optional[Union[str, Tick]] Must match the `freq` on the `data` if `data` is a DatetimeIndex or Series. tz : Optional[tzin...
pandas/core/arrays/period.py
def dt64arr_to_periodarr(data, freq, tz=None): """ Convert an datetime-like array to values Period ordinals. Parameters ---------- data : Union[Series[datetime64[ns]], DatetimeIndex, ndarray[datetime64ns]] freq : Optional[Union[str, Tick]] Must match the `freq` on the `data` if `data` i...
def dt64arr_to_periodarr(data, freq, tz=None): """ Convert an datetime-like array to values Period ordinals. Parameters ---------- data : Union[Series[datetime64[ns]], DatetimeIndex, ndarray[datetime64ns]] freq : Optional[Union[str, Tick]] Must match the `freq` on the `data` if `data` i...
[ "Convert", "an", "datetime", "-", "like", "array", "to", "values", "Period", "ordinals", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L828-L863
[ "def", "dt64arr_to_periodarr", "(", "data", ",", "freq", ",", "tz", "=", "None", ")", ":", "if", "data", ".", "dtype", "!=", "np", ".", "dtype", "(", "'M8[ns]'", ")", ":", "raise", "ValueError", "(", "'Wrong dtype: {dtype}'", ".", "format", "(", "dtype",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._from_datetime64
Construct a PeriodArray from a datetime64 array Parameters ---------- data : ndarray[datetime64[ns], datetime64[ns, tz]] freq : str or Tick tz : tzinfo, optional Returns ------- PeriodArray[freq]
pandas/core/arrays/period.py
def _from_datetime64(cls, data, freq, tz=None): """ Construct a PeriodArray from a datetime64 array Parameters ---------- data : ndarray[datetime64[ns], datetime64[ns, tz]] freq : str or Tick tz : tzinfo, optional Returns ------- PeriodAr...
def _from_datetime64(cls, data, freq, tz=None): """ Construct a PeriodArray from a datetime64 array Parameters ---------- data : ndarray[datetime64[ns], datetime64[ns, tz]] freq : str or Tick tz : tzinfo, optional Returns ------- PeriodAr...
[ "Construct", "a", "PeriodArray", "from", "a", "datetime64", "array" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L211-L226
[ "def", "_from_datetime64", "(", "cls", ",", "data", ",", "freq", ",", "tz", "=", "None", ")", ":", "data", ",", "freq", "=", "dt64arr_to_periodarr", "(", "data", ",", "freq", ",", "tz", ")", "return", "cls", "(", "data", ",", "freq", "=", "freq", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray.to_timestamp
Cast to DatetimeArray/Index. Parameters ---------- freq : string or DateOffset, optional Target frequency. The default is 'D' for week or longer, 'S' otherwise how : {'s', 'e', 'start', 'end'} Returns ------- DatetimeArray/Index
pandas/core/arrays/period.py
def to_timestamp(self, freq=None, how='start'): """ Cast to DatetimeArray/Index. Parameters ---------- freq : string or DateOffset, optional Target frequency. The default is 'D' for week or longer, 'S' otherwise how : {'s', 'e', 'start', 'end'} ...
def to_timestamp(self, freq=None, how='start'): """ Cast to DatetimeArray/Index. Parameters ---------- freq : string or DateOffset, optional Target frequency. The default is 'D' for week or longer, 'S' otherwise how : {'s', 'e', 'start', 'end'} ...
[ "Cast", "to", "DatetimeArray", "/", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L327-L366
[ "def", "to_timestamp", "(", "self", ",", "freq", "=", "None", ",", "how", "=", "'start'", ")", ":", "from", "pandas", ".", "core", ".", "arrays", "import", "DatetimeArray", "how", "=", "libperiod", ".", "_validate_end_alias", "(", "how", ")", "end", "=",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._time_shift
Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int Number of periods to shift by. freq : pandas.DateOf...
pandas/core/arrays/period.py
def _time_shift(self, periods, freq=None): """ Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int ...
def _time_shift(self, periods, freq=None): """ Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int ...
[ "Shift", "each", "value", "by", "periods", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L390-L412
[ "def", "_time_shift", "(", "self", ",", "periods", ",", "freq", "=", "None", ")", ":", "if", "freq", "is", "not", "None", ":", "raise", "TypeError", "(", "\"`freq` argument is not supported for \"", "\"{cls}._time_shift\"", ".", "format", "(", "cls", "=", "typ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray.asfreq
Convert the Period Array/Index to the specified frequency `freq`. Parameters ---------- freq : str a frequency how : str {'E', 'S'} 'E', 'END', or 'FINISH' for end, 'S', 'START', or 'BEGIN' for start. Whether the elements should be aligned...
pandas/core/arrays/period.py
def asfreq(self, freq=None, how='E'): """ Convert the Period Array/Index to the specified frequency `freq`. Parameters ---------- freq : str a frequency how : str {'E', 'S'} 'E', 'END', or 'FINISH' for end, 'S', 'START', or 'BEGIN' for...
def asfreq(self, freq=None, how='E'): """ Convert the Period Array/Index to the specified frequency `freq`. Parameters ---------- freq : str a frequency how : str {'E', 'S'} 'E', 'END', or 'FINISH' for end, 'S', 'START', or 'BEGIN' for...
[ "Convert", "the", "Period", "Array", "/", "Index", "to", "the", "specified", "frequency", "freq", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L418-L472
[ "def", "asfreq", "(", "self", ",", "freq", "=", "None", ",", "how", "=", "'E'", ")", ":", "how", "=", "libperiod", ".", "_validate_end_alias", "(", "how", ")", "freq", "=", "Period", ".", "_maybe_convert_freq", "(", "freq", ")", "base1", ",", "mult1", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._format_native_types
actually format my specific types
pandas/core/arrays/period.py
def _format_native_types(self, na_rep='NaT', date_format=None, **kwargs): """ actually format my specific types """ values = self.astype(object) if date_format: formatter = lambda dt: dt.strftime(date_format) else: formatter = lambda dt: '%s' % dt...
def _format_native_types(self, na_rep='NaT', date_format=None, **kwargs): """ actually format my specific types """ values = self.astype(object) if date_format: formatter = lambda dt: dt.strftime(date_format) else: formatter = lambda dt: '%s' % dt...
[ "actually", "format", "my", "specific", "types" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L477-L496
[ "def", "_format_native_types", "(", "self", ",", "na_rep", "=", "'NaT'", ",", "date_format", "=", "None", ",", "*", "*", "kwargs", ")", ":", "values", "=", "self", ".", "astype", "(", "object", ")", "if", "date_format", ":", "formatter", "=", "lambda", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._add_timedeltalike_scalar
Parameters ---------- other : timedelta, Tick, np.timedelta64 Returns ------- result : ndarray[int64]
pandas/core/arrays/period.py
def _add_timedeltalike_scalar(self, other): """ Parameters ---------- other : timedelta, Tick, np.timedelta64 Returns ------- result : ndarray[int64] """ assert isinstance(self.freq, Tick) # checked by calling function assert isinstance(o...
def _add_timedeltalike_scalar(self, other): """ Parameters ---------- other : timedelta, Tick, np.timedelta64 Returns ------- result : ndarray[int64] """ assert isinstance(self.freq, Tick) # checked by calling function assert isinstance(o...
[ "Parameters", "----------", "other", ":", "timedelta", "Tick", "np", ".", "timedelta64" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L565-L587
[ "def", "_add_timedeltalike_scalar", "(", "self", ",", "other", ")", ":", "assert", "isinstance", "(", "self", ".", "freq", ",", "Tick", ")", "# checked by calling function", "assert", "isinstance", "(", "other", ",", "(", "timedelta", ",", "np", ".", "timedelt...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._add_delta_tdi
Parameters ---------- other : TimedeltaArray or ndarray[timedelta64] Returns ------- result : ndarray[int64]
pandas/core/arrays/period.py
def _add_delta_tdi(self, other): """ Parameters ---------- other : TimedeltaArray or ndarray[timedelta64] Returns ------- result : ndarray[int64] """ assert isinstance(self.freq, Tick) # checked by calling function delta = self._check_ti...
def _add_delta_tdi(self, other): """ Parameters ---------- other : TimedeltaArray or ndarray[timedelta64] Returns ------- result : ndarray[int64] """ assert isinstance(self.freq, Tick) # checked by calling function delta = self._check_ti...
[ "Parameters", "----------", "other", ":", "TimedeltaArray", "or", "ndarray", "[", "timedelta64", "]" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L589-L602
[ "def", "_add_delta_tdi", "(", "self", ",", "other", ")", ":", "assert", "isinstance", "(", "self", ".", "freq", ",", "Tick", ")", "# checked by calling function", "delta", "=", "self", ".", "_check_timedeltalike_freq_compat", "(", "other", ")", "return", "self",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._add_delta
Add a timedelta-like, Tick, or TimedeltaIndex-like object to self, yielding a new PeriodArray Parameters ---------- other : {timedelta, np.timedelta64, Tick, TimedeltaIndex, ndarray[timedelta64]} Returns ------- result : PeriodArray
pandas/core/arrays/period.py
def _add_delta(self, other): """ Add a timedelta-like, Tick, or TimedeltaIndex-like object to self, yielding a new PeriodArray Parameters ---------- other : {timedelta, np.timedelta64, Tick, TimedeltaIndex, ndarray[timedelta64]} Returns ...
def _add_delta(self, other): """ Add a timedelta-like, Tick, or TimedeltaIndex-like object to self, yielding a new PeriodArray Parameters ---------- other : {timedelta, np.timedelta64, Tick, TimedeltaIndex, ndarray[timedelta64]} Returns ...
[ "Add", "a", "timedelta", "-", "like", "Tick", "or", "TimedeltaIndex", "-", "like", "object", "to", "self", "yielding", "a", "new", "PeriodArray" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L604-L623
[ "def", "_add_delta", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "self", ".", "freq", ",", "Tick", ")", ":", "# We cannot add timedelta-like to non-tick PeriodArray", "_raise_on_incompatible", "(", "self", ",", "other", ")", "new_ordinals"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
PeriodArray._check_timedeltalike_freq_compat
Arithmetic operations with timedelta-like scalars or array `other` are only valid if `other` is an integer multiple of `self.freq`. If the operation is valid, find that integer multiple. Otherwise, raise because the operation is invalid. Parameters ---------- other : ti...
pandas/core/arrays/period.py
def _check_timedeltalike_freq_compat(self, other): """ Arithmetic operations with timedelta-like scalars or array `other` are only valid if `other` is an integer multiple of `self.freq`. If the operation is valid, find that integer multiple. Otherwise, raise because the operatio...
def _check_timedeltalike_freq_compat(self, other): """ Arithmetic operations with timedelta-like scalars or array `other` are only valid if `other` is an integer multiple of `self.freq`. If the operation is valid, find that integer multiple. Otherwise, raise because the operatio...
[ "Arithmetic", "operations", "with", "timedelta", "-", "like", "scalars", "or", "array", "other", "are", "only", "valid", "if", "other", "is", "an", "integer", "multiple", "of", "self", ".", "freq", ".", "If", "the", "operation", "is", "valid", "find", "tha...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L625-L672
[ "def", "_check_timedeltalike_freq_compat", "(", "self", ",", "other", ")", ":", "assert", "isinstance", "(", "self", ".", "freq", ",", "Tick", ")", "# checked by calling function", "own_offset", "=", "frequencies", ".", "to_offset", "(", "self", ".", "freq", "."...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_isna_old
Detect missing values. Treat None, NaN, INF, -INF as null. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean
pandas/core/dtypes/missing.py
def _isna_old(obj): """Detect missing values. Treat None, NaN, INF, -INF as null. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean """ if is_scalar(obj): return libmissing.checknull_old(obj) # hack (for now) because MI regist...
def _isna_old(obj): """Detect missing values. Treat None, NaN, INF, -INF as null. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean """ if is_scalar(obj): return libmissing.checknull_old(obj) # hack (for now) because MI regist...
[ "Detect", "missing", "values", ".", "Treat", "None", "NaN", "INF", "-", "INF", "as", "null", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L126-L151
[ "def", "_isna_old", "(", "obj", ")", ":", "if", "is_scalar", "(", "obj", ")", ":", "return", "libmissing", ".", "checknull_old", "(", "obj", ")", "# hack (for now) because MI registers as ndarray", "elif", "isinstance", "(", "obj", ",", "ABCMultiIndex", ")", ":"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_use_inf_as_na
Option change callback for na/inf behaviour Choose which replacement for numpy.isnan / -numpy.isfinite is used. Parameters ---------- flag: bool True means treat None, NaN, INF, -INF as null (old way), False means None and NaN are null, but INF, -INF are not null (new way). ...
pandas/core/dtypes/missing.py
def _use_inf_as_na(key): """Option change callback for na/inf behaviour Choose which replacement for numpy.isnan / -numpy.isfinite is used. Parameters ---------- flag: bool True means treat None, NaN, INF, -INF as null (old way), False means None and NaN are null, but INF, -INF are ...
def _use_inf_as_na(key): """Option change callback for na/inf behaviour Choose which replacement for numpy.isnan / -numpy.isfinite is used. Parameters ---------- flag: bool True means treat None, NaN, INF, -INF as null (old way), False means None and NaN are null, but INF, -INF are ...
[ "Option", "change", "callback", "for", "na", "/", "inf", "behaviour", "Choose", "which", "replacement", "for", "numpy", ".", "isnan", "/", "-", "numpy", ".", "isfinite", "is", "used", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L157-L181
[ "def", "_use_inf_as_na", "(", "key", ")", ":", "from", "pandas", ".", "_config", "import", "get_option", "flag", "=", "get_option", "(", "key", ")", "if", "flag", ":", "globals", "(", ")", "[", "'_isna'", "]", "=", "_isna_old", "else", ":", "globals", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_isna_compat
Parameters ---------- arr: a numpy array fill_value: fill value, default to np.nan Returns ------- True if we can fill using this fill_value
pandas/core/dtypes/missing.py
def _isna_compat(arr, fill_value=np.nan): """ Parameters ---------- arr: a numpy array fill_value: fill value, default to np.nan Returns ------- True if we can fill using this fill_value """ dtype = arr.dtype if isna(fill_value): return not (is_bool_dtype(dtype) or ...
def _isna_compat(arr, fill_value=np.nan): """ Parameters ---------- arr: a numpy array fill_value: fill value, default to np.nan Returns ------- True if we can fill using this fill_value """ dtype = arr.dtype if isna(fill_value): return not (is_bool_dtype(dtype) or ...
[ "Parameters", "----------", "arr", ":", "a", "numpy", "array", "fill_value", ":", "fill", "value", "default", "to", "np", ".", "nan" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L343-L358
[ "def", "_isna_compat", "(", "arr", ",", "fill_value", "=", "np", ".", "nan", ")", ":", "dtype", "=", "arr", ".", "dtype", "if", "isna", "(", "fill_value", ")", ":", "return", "not", "(", "is_bool_dtype", "(", "dtype", ")", "or", "is_integer_dtype", "("...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
array_equivalent
True if two arrays, left and right, have equal non-NaN elements, and NaNs in corresponding locations. False otherwise. It is assumed that left and right are NumPy arrays of the same dtype. The behavior of this function (particularly with respect to NaNs) is not defined if the dtypes are different. ...
pandas/core/dtypes/missing.py
def array_equivalent(left, right, strict_nan=False): """ True if two arrays, left and right, have equal non-NaN elements, and NaNs in corresponding locations. False otherwise. It is assumed that left and right are NumPy arrays of the same dtype. The behavior of this function (particularly with resp...
def array_equivalent(left, right, strict_nan=False): """ True if two arrays, left and right, have equal non-NaN elements, and NaNs in corresponding locations. False otherwise. It is assumed that left and right are NumPy arrays of the same dtype. The behavior of this function (particularly with resp...
[ "True", "if", "two", "arrays", "left", "and", "right", "have", "equal", "non", "-", "NaN", "elements", "and", "NaNs", "in", "corresponding", "locations", ".", "False", "otherwise", ".", "It", "is", "assumed", "that", "left", "and", "right", "are", "NumPy",...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L361-L446
[ "def", "array_equivalent", "(", "left", ",", "right", ",", "strict_nan", "=", "False", ")", ":", "left", ",", "right", "=", "np", ".", "asarray", "(", "left", ")", ",", "np", ".", "asarray", "(", "right", ")", "# shape compat", "if", "left", ".", "sh...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_infer_fill_value
infer the fill value for the nan/NaT from the provided scalar/ndarray/list-like if we are a NaT, return the correct dtyped element to provide proper block construction
pandas/core/dtypes/missing.py
def _infer_fill_value(val): """ infer the fill value for the nan/NaT from the provided scalar/ndarray/list-like if we are a NaT, return the correct dtyped element to provide proper block construction """ if not is_list_like(val): val = [val] val = np.array(val, copy=False) if is...
def _infer_fill_value(val): """ infer the fill value for the nan/NaT from the provided scalar/ndarray/list-like if we are a NaT, return the correct dtyped element to provide proper block construction """ if not is_list_like(val): val = [val] val = np.array(val, copy=False) if is...
[ "infer", "the", "fill", "value", "for", "the", "nan", "/", "NaT", "from", "the", "provided", "scalar", "/", "ndarray", "/", "list", "-", "like", "if", "we", "are", "a", "NaT", "return", "the", "correct", "dtyped", "element", "to", "provide", "proper", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L449-L467
[ "def", "_infer_fill_value", "(", "val", ")", ":", "if", "not", "is_list_like", "(", "val", ")", ":", "val", "=", "[", "val", "]", "val", "=", "np", ".", "array", "(", "val", ",", "copy", "=", "False", ")", "if", "is_datetimelike", "(", "val", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_maybe_fill
if we have a compatible fill_value and arr dtype, then fill
pandas/core/dtypes/missing.py
def _maybe_fill(arr, fill_value=np.nan): """ if we have a compatible fill_value and arr dtype, then fill """ if _isna_compat(arr, fill_value): arr.fill(fill_value) return arr
def _maybe_fill(arr, fill_value=np.nan): """ if we have a compatible fill_value and arr dtype, then fill """ if _isna_compat(arr, fill_value): arr.fill(fill_value) return arr
[ "if", "we", "have", "a", "compatible", "fill_value", "and", "arr", "dtype", "then", "fill" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L470-L476
[ "def", "_maybe_fill", "(", "arr", ",", "fill_value", "=", "np", ".", "nan", ")", ":", "if", "_isna_compat", "(", "arr", ",", "fill_value", ")", ":", "arr", ".", "fill", "(", "fill_value", ")", "return", "arr" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
na_value_for_dtype
Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : boolean, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 >>> na_value_for_dtype(np.dtype('int64'), compat=False) ...
pandas/core/dtypes/missing.py
def na_value_for_dtype(dtype, compat=True): """ Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : boolean, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 >...
def na_value_for_dtype(dtype, compat=True): """ Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : boolean, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 >...
[ "Return", "a", "dtype", "compat", "na", "value" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L479-L520
[ "def", "na_value_for_dtype", "(", "dtype", ",", "compat", "=", "True", ")", ":", "dtype", "=", "pandas_dtype", "(", "dtype", ")", "if", "is_extension_array_dtype", "(", "dtype", ")", ":", "return", "dtype", ".", "na_value", "if", "(", "is_datetime64_dtype", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
remove_na_arraylike
Return array-like containing only true/non-NaN values, possibly empty.
pandas/core/dtypes/missing.py
def remove_na_arraylike(arr): """ Return array-like containing only true/non-NaN values, possibly empty. """ if is_extension_array_dtype(arr): return arr[notna(arr)] else: return arr[notna(lib.values_from_object(arr))]
def remove_na_arraylike(arr): """ Return array-like containing only true/non-NaN values, possibly empty. """ if is_extension_array_dtype(arr): return arr[notna(arr)] else: return arr[notna(lib.values_from_object(arr))]
[ "Return", "array", "-", "like", "containing", "only", "true", "/", "non", "-", "NaN", "values", "possibly", "empty", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L523-L530
[ "def", "remove_na_arraylike", "(", "arr", ")", ":", "if", "is_extension_array_dtype", "(", "arr", ")", ":", "return", "arr", "[", "notna", "(", "arr", ")", "]", "else", ":", "return", "arr", "[", "notna", "(", "lib", ".", "values_from_object", "(", "arr"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
table
Helper function to convert DataFrame and Series to matplotlib.table Parameters ---------- ax : Matplotlib axes object data : DataFrame or Series data for table contents kwargs : keywords, optional keyword arguments which passed to matplotlib.table.table. If `rowLabels` or `c...
pandas/plotting/_tools.py
def table(ax, data, rowLabels=None, colLabels=None, **kwargs): """ Helper function to convert DataFrame and Series to matplotlib.table Parameters ---------- ax : Matplotlib axes object data : DataFrame or Series data for table contents kwargs : keywords, optional keyword arg...
def table(ax, data, rowLabels=None, colLabels=None, **kwargs): """ Helper function to convert DataFrame and Series to matplotlib.table Parameters ---------- ax : Matplotlib axes object data : DataFrame or Series data for table contents kwargs : keywords, optional keyword arg...
[ "Helper", "function", "to", "convert", "DataFrame", "and", "Series", "to", "matplotlib", ".", "table" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_tools.py#L23-L60
[ "def", "table", "(", "ax", ",", "data", ",", "rowLabels", "=", "None", ",", "colLabels", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "data", ",", "ABCSeries", ")", ":", "data", "=", "data", ".", "to_frame", "(", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_subplots
Create a figure with a set of subplots already made. This utility wrapper makes it convenient to create common layouts of subplots, including the enclosing figure object, in a single call. Keyword arguments: naxes : int Number of required axes. Exceeded axes are set invisible. Default is ...
pandas/plotting/_tools.py
def _subplots(naxes=None, sharex=False, sharey=False, squeeze=True, subplot_kw=None, ax=None, layout=None, layout_type='box', **fig_kw): """Create a figure with a set of subplots already made. This utility wrapper makes it convenient to create common layouts of subplots, includi...
def _subplots(naxes=None, sharex=False, sharey=False, squeeze=True, subplot_kw=None, ax=None, layout=None, layout_type='box', **fig_kw): """Create a figure with a set of subplots already made. This utility wrapper makes it convenient to create common layouts of subplots, includi...
[ "Create", "a", "figure", "with", "a", "set", "of", "subplots", "already", "made", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_tools.py#L110-L271
[ "def", "_subplots", "(", "naxes", "=", "None", ",", "sharex", "=", "False", ",", "sharey", "=", "False", ",", "squeeze", "=", "True", ",", "subplot_kw", "=", "None", ",", "ax", "=", "None", ",", "layout", "=", "None", ",", "layout_type", "=", "'box'"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
maybe_cythonize
Render tempita templates before calling cythonize
setup.py
def maybe_cythonize(extensions, *args, **kwargs): """ Render tempita templates before calling cythonize """ if len(sys.argv) > 1 and 'clean' in sys.argv: # Avoid running cythonize on `python setup.py clean` # See https://github.com/cython/cython/issues/1495 return extensions ...
def maybe_cythonize(extensions, *args, **kwargs): """ Render tempita templates before calling cythonize """ if len(sys.argv) > 1 and 'clean' in sys.argv: # Avoid running cythonize on `python setup.py clean` # See https://github.com/cython/cython/issues/1495 return extensions ...
[ "Render", "tempita", "templates", "before", "calling", "cythonize" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/setup.py#L490-L512
[ "def", "maybe_cythonize", "(", "extensions", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", ">", "1", "and", "'clean'", "in", "sys", ".", "argv", ":", "# Avoid running cythonize on `python setup.py clean`", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrameGroupBy._transform_fast
Fast transform path for aggregations
pandas/core/groupby/generic.py
def _transform_fast(self, result, obj, func_nm): """ Fast transform path for aggregations """ # if there were groups with no observations (Categorical only?) # try casting data to original dtype cast = self._transform_should_cast(func_nm) # for each col, reshape ...
def _transform_fast(self, result, obj, func_nm): """ Fast transform path for aggregations """ # if there were groups with no observations (Categorical only?) # try casting data to original dtype cast = self._transform_should_cast(func_nm) # for each col, reshape ...
[ "Fast", "transform", "path", "for", "aggregations" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L526-L545
[ "def", "_transform_fast", "(", "self", ",", "result", ",", "obj", ",", "func_nm", ")", ":", "# if there were groups with no observations (Categorical only?)", "# try casting data to original dtype", "cast", "=", "self", ".", "_transform_should_cast", "(", "func_nm", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
NDFrameGroupBy.filter
Return a copy of a DataFrame excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- f : function Function to apply to each subframe. Should return True or False. dropna : Drop groups that do not pass the filt...
pandas/core/groupby/generic.py
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a DataFrame excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- f : function Function to apply to each subframe. S...
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a DataFrame excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- f : function Function to apply to each subframe. S...
[ "Return", "a", "copy", "of", "a", "DataFrame", "excluding", "elements", "from", "groups", "that", "do", "not", "satisfy", "the", "boolean", "criterion", "specified", "by", "func", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L601-L661
[ "def", "filter", "(", "self", ",", "func", ",", "dropna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa", "indices", "=", "[", "]", "obj", "=", "self", ".", "_selected_obj", "gen", "=", "self", ".", "grouper", ".", "ge...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SeriesGroupBy._wrap_output
common agg/transform wrapping logic
pandas/core/groupby/generic.py
def _wrap_output(self, output, index, names=None): """ common agg/transform wrapping logic """ output = output[self._selection_name] if names is not None: return DataFrame(output, index=index, columns=names) else: name = self._selection_name if name i...
def _wrap_output(self, output, index, names=None): """ common agg/transform wrapping logic """ output = output[self._selection_name] if names is not None: return DataFrame(output, index=index, columns=names) else: name = self._selection_name if name i...
[ "common", "agg", "/", "transform", "wrapping", "logic" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L825-L835
[ "def", "_wrap_output", "(", "self", ",", "output", ",", "index", ",", "names", "=", "None", ")", ":", "output", "=", "output", "[", "self", ".", "_selection_name", "]", "if", "names", "is", "not", "None", ":", "return", "DataFrame", "(", "output", ",",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SeriesGroupBy._transform_fast
fast version of transform, only applicable to builtin/cythonizable functions
pandas/core/groupby/generic.py
def _transform_fast(self, func, func_nm): """ fast version of transform, only applicable to builtin/cythonizable functions """ if isinstance(func, str): func = getattr(self, func) ids, _, ngroup = self.grouper.group_info cast = self._transform_should_...
def _transform_fast(self, func, func_nm): """ fast version of transform, only applicable to builtin/cythonizable functions """ if isinstance(func, str): func = getattr(self, func) ids, _, ngroup = self.grouper.group_info cast = self._transform_should_...
[ "fast", "version", "of", "transform", "only", "applicable", "to", "builtin", "/", "cythonizable", "functions" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L934-L947
[ "def", "_transform_fast", "(", "self", ",", "func", ",", "func_nm", ")", ":", "if", "isinstance", "(", "func", ",", "str", ")", ":", "func", "=", "getattr", "(", "self", ",", "func", ")", "ids", ",", "_", ",", "ngroup", "=", "self", ".", "grouper",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SeriesGroupBy.filter
Return a copy of a Series excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- func : function To apply to each group. Should return True or False. dropna : Drop groups that do not pass the filter. True by ...
pandas/core/groupby/generic.py
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a Series excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- func : function To apply to each group. Should return...
def filter(self, func, dropna=True, *args, **kwargs): # noqa """ Return a copy of a Series excluding elements from groups that do not satisfy the boolean criterion specified by func. Parameters ---------- func : function To apply to each group. Should return...
[ "Return", "a", "copy", "of", "a", "Series", "excluding", "elements", "from", "groups", "that", "do", "not", "satisfy", "the", "boolean", "criterion", "specified", "by", "func", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L949-L997
[ "def", "filter", "(", "self", ",", "func", ",", "dropna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa", "if", "isinstance", "(", "func", ",", "str", ")", ":", "wrapper", "=", "lambda", "x", ":", "getattr", "(", "x", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SeriesGroupBy.nunique
Return number of unique elements in the group.
pandas/core/groupby/generic.py
def nunique(self, dropna=True): """ Return number of unique elements in the group. """ ids, _, _ = self.grouper.group_info val = self.obj.get_values() try: sorter = np.lexsort((val, ids)) except TypeError: # catches object dtypes msg = '...
def nunique(self, dropna=True): """ Return number of unique elements in the group. """ ids, _, _ = self.grouper.group_info val = self.obj.get_values() try: sorter = np.lexsort((val, ids)) except TypeError: # catches object dtypes msg = '...
[ "Return", "number", "of", "unique", "elements", "in", "the", "group", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L999-L1054
[ "def", "nunique", "(", "self", ",", "dropna", "=", "True", ")", ":", "ids", ",", "_", ",", "_", "=", "self", ".", "grouper", ".", "group_info", "val", "=", "self", ".", "obj", ".", "get_values", "(", ")", "try", ":", "sorter", "=", "np", ".", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SeriesGroupBy.count
Compute count of group, excluding missing values
pandas/core/groupby/generic.py
def count(self): """ Compute count of group, excluding missing values """ ids, _, ngroups = self.grouper.group_info val = self.obj.get_values() mask = (ids != -1) & ~isna(val) ids = ensure_platform_int(ids) minlength = ngroups or 0 out = np.bincount(ids[mask], mi...
def count(self): """ Compute count of group, excluding missing values """ ids, _, ngroups = self.grouper.group_info val = self.obj.get_values() mask = (ids != -1) & ~isna(val) ids = ensure_platform_int(ids) minlength = ngroups or 0 out = np.bincount(ids[mask], mi...
[ "Compute", "count", "of", "group", "excluding", "missing", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1183-L1196
[ "def", "count", "(", "self", ")", ":", "ids", ",", "_", ",", "ngroups", "=", "self", ".", "grouper", ".", "group_info", "val", "=", "self", ".", "obj", ".", "get_values", "(", ")", "mask", "=", "(", "ids", "!=", "-", "1", ")", "&", "~", "isna",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
SeriesGroupBy.pct_change
Calcuate pct_change of each value to previous entry in group
pandas/core/groupby/generic.py
def pct_change(self, periods=1, fill_method='pad', limit=None, freq=None): """Calcuate pct_change of each value to previous entry in group""" # TODO: Remove this conditional when #23918 is fixed if freq: return self.apply(lambda x: x.pct_change(periods=periods, ...
def pct_change(self, periods=1, fill_method='pad', limit=None, freq=None): """Calcuate pct_change of each value to previous entry in group""" # TODO: Remove this conditional when #23918 is fixed if freq: return self.apply(lambda x: x.pct_change(periods=periods, ...
[ "Calcuate", "pct_change", "of", "each", "value", "to", "previous", "entry", "in", "group" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1202-L1213
[ "def", "pct_change", "(", "self", ",", "periods", "=", "1", ",", "fill_method", "=", "'pad'", ",", "limit", "=", "None", ",", "freq", "=", "None", ")", ":", "# TODO: Remove this conditional when #23918 is fixed", "if", "freq", ":", "return", "self", ".", "ap...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameGroupBy._gotitem
sub-classes to define return a sliced object Parameters ---------- key : string / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on
pandas/core/groupby/generic.py
def _gotitem(self, key, ndim, subset=None): """ sub-classes to define return a sliced object Parameters ---------- key : string / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on...
def _gotitem(self, key, ndim, subset=None): """ sub-classes to define return a sliced object Parameters ---------- key : string / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on...
[ "sub", "-", "classes", "to", "define", "return", "a", "sliced", "object" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1297-L1325
[ "def", "_gotitem", "(", "self", ",", "key", ",", "ndim", ",", "subset", "=", "None", ")", ":", "if", "ndim", "==", "2", ":", "if", "subset", "is", "None", ":", "subset", "=", "self", ".", "obj", "return", "DataFrameGroupBy", "(", "subset", ",", "se...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameGroupBy._reindex_output
If we have categorical groupers, then we want to make sure that we have a fully reindex-output to the levels. These may have not participated in the groupings (e.g. may have all been nan groups); This can re-expand the output space
pandas/core/groupby/generic.py
def _reindex_output(self, result): """ If we have categorical groupers, then we want to make sure that we have a fully reindex-output to the levels. These may have not participated in the groupings (e.g. may have all been nan groups); This can re-expand the output space ...
def _reindex_output(self, result): """ If we have categorical groupers, then we want to make sure that we have a fully reindex-output to the levels. These may have not participated in the groupings (e.g. may have all been nan groups); This can re-expand the output space ...
[ "If", "we", "have", "categorical", "groupers", "then", "we", "want", "to", "make", "sure", "that", "we", "have", "a", "fully", "reindex", "-", "output", "to", "the", "levels", ".", "These", "may", "have", "not", "participated", "in", "the", "groupings", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1395-L1456
[ "def", "_reindex_output", "(", "self", ",", "result", ")", ":", "# we need to re-expand the output space to accomodate all values", "# whether observed or not in the cartesian product of our groupes", "groupings", "=", "self", ".", "grouper", ".", "groupings", "if", "groupings", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameGroupBy._fill
Overridden method to join grouped columns in output
pandas/core/groupby/generic.py
def _fill(self, direction, limit=None): """Overridden method to join grouped columns in output""" res = super()._fill(direction, limit=limit) output = OrderedDict( (grp.name, grp.grouper) for grp in self.grouper.groupings) from pandas import concat return concat((sel...
def _fill(self, direction, limit=None): """Overridden method to join grouped columns in output""" res = super()._fill(direction, limit=limit) output = OrderedDict( (grp.name, grp.grouper) for grp in self.grouper.groupings) from pandas import concat return concat((sel...
[ "Overridden", "method", "to", "join", "grouped", "columns", "in", "output" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1472-L1479
[ "def", "_fill", "(", "self", ",", "direction", ",", "limit", "=", "None", ")", ":", "res", "=", "super", "(", ")", ".", "_fill", "(", "direction", ",", "limit", "=", "limit", ")", "output", "=", "OrderedDict", "(", "(", "grp", ".", "name", ",", "...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameGroupBy.count
Compute count of group, excluding missing values
pandas/core/groupby/generic.py
def count(self): """ Compute count of group, excluding missing values """ from pandas.core.dtypes.missing import _isna_ndarraylike as _isna data, _ = self._get_data_to_aggregate() ids, _, ngroups = self.grouper.group_info mask = ids != -1 val = ((mask & ~_isna(np.atleas...
def count(self): """ Compute count of group, excluding missing values """ from pandas.core.dtypes.missing import _isna_ndarraylike as _isna data, _ = self._get_data_to_aggregate() ids, _, ngroups = self.grouper.group_info mask = ids != -1 val = ((mask & ~_isna(np.atleas...
[ "Compute", "count", "of", "group", "excluding", "missing", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1481-L1497
[ "def", "count", "(", "self", ")", ":", "from", "pandas", ".", "core", ".", "dtypes", ".", "missing", "import", "_isna_ndarraylike", "as", "_isna", "data", ",", "_", "=", "self", ".", "_get_data_to_aggregate", "(", ")", "ids", ",", "_", ",", "ngroups", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
DataFrameGroupBy.nunique
Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ------- nunique: DataFrame Examp...
pandas/core/groupby/generic.py
def nunique(self, dropna=True): """ Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ...
def nunique(self, dropna=True): """ Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ...
[ "Return", "DataFrame", "with", "number", "of", "distinct", "observations", "per", "group", "for", "each", "column", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1499-L1564
[ "def", "nunique", "(", "self", ",", "dropna", "=", "True", ")", ":", "obj", "=", "self", ".", "_selected_obj", "def", "groupby_series", "(", "obj", ",", "col", "=", "None", ")", ":", "return", "SeriesGroupBy", "(", "obj", ",", "selection", "=", "col", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
extract_array
Extract the ndarray or ExtensionArray from a Series or Index. For all other types, `obj` is just returned as is. Parameters ---------- obj : object For Series / Index, the underlying ExtensionArray is unboxed. For Numpy-backed ExtensionArrays, the ndarray is extracted. extract_num...
pandas/core/internals/arrays.py
def extract_array(obj, extract_numpy=False): """ Extract the ndarray or ExtensionArray from a Series or Index. For all other types, `obj` is just returned as is. Parameters ---------- obj : object For Series / Index, the underlying ExtensionArray is unboxed. For Numpy-backed Ex...
def extract_array(obj, extract_numpy=False): """ Extract the ndarray or ExtensionArray from a Series or Index. For all other types, `obj` is just returned as is. Parameters ---------- obj : object For Series / Index, the underlying ExtensionArray is unboxed. For Numpy-backed Ex...
[ "Extract", "the", "ndarray", "or", "ExtensionArray", "from", "a", "Series", "or", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/arrays.py#L7-L55
[ "def", "extract_array", "(", "obj", ",", "extract_numpy", "=", "False", ")", ":", "if", "isinstance", "(", "obj", ",", "(", "ABCIndexClass", ",", "ABCSeries", ")", ")", ":", "obj", "=", "obj", ".", "array", "if", "extract_numpy", "and", "isinstance", "("...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
flatten
Flatten an arbitrarily nested sequence. Parameters ---------- l : sequence The non string sequence to flatten Notes ----- This doesn't consider strings sequences. Returns ------- flattened : generator
pandas/core/common.py
def flatten(l): """ Flatten an arbitrarily nested sequence. Parameters ---------- l : sequence The non string sequence to flatten Notes ----- This doesn't consider strings sequences. Returns ------- flattened : generator """ for el in l: if _iterabl...
def flatten(l): """ Flatten an arbitrarily nested sequence. Parameters ---------- l : sequence The non string sequence to flatten Notes ----- This doesn't consider strings sequences. Returns ------- flattened : generator """ for el in l: if _iterabl...
[ "Flatten", "an", "arbitrarily", "nested", "sequence", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L35-L57
[ "def", "flatten", "(", "l", ")", ":", "for", "el", "in", "l", ":", "if", "_iterable_not_string", "(", "el", ")", ":", "for", "s", "in", "flatten", "(", "el", ")", ":", "yield", "s", "else", ":", "yield", "el" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_bool_indexer
Check whether `key` is a valid boolean indexer. Parameters ---------- key : Any Only list-likes may be considered boolean indexers. All other types are not considered a boolean indexer. For array-like input, boolean ndarrays or ExtensionArrays with ``_is_boolean`` set are co...
pandas/core/common.py
def is_bool_indexer(key: Any) -> bool: """ Check whether `key` is a valid boolean indexer. Parameters ---------- key : Any Only list-likes may be considered boolean indexers. All other types are not considered a boolean indexer. For array-like input, boolean ndarrays or Exte...
def is_bool_indexer(key: Any) -> bool: """ Check whether `key` is a valid boolean indexer. Parameters ---------- key : Any Only list-likes may be considered boolean indexers. All other types are not considered a boolean indexer. For array-like input, boolean ndarrays or Exte...
[ "Check", "whether", "key", "is", "a", "valid", "boolean", "indexer", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L95-L142
[ "def", "is_bool_indexer", "(", "key", ":", "Any", ")", "->", "bool", ":", "na_msg", "=", "'cannot index with vector containing NA / NaN values'", "if", "(", "isinstance", "(", "key", ",", "(", "ABCSeries", ",", "np", ".", "ndarray", ",", "ABCIndex", ")", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
cast_scalar_indexer
To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters ---------- val : scalar Returns ------- outval : scalar
pandas/core/common.py
def cast_scalar_indexer(val): """ To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters ---------- val : scalar Returns ------- outval : scalar """ # assumes lib.is_scalar(val) if lib.is_float(val) and val == int(val): return int(val) ...
def cast_scalar_indexer(val): """ To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters ---------- val : scalar Returns ------- outval : scalar """ # assumes lib.is_scalar(val) if lib.is_float(val) and val == int(val): return int(val) ...
[ "To", "avoid", "numpy", "DeprecationWarnings", "cast", "float", "to", "integer", "where", "valid", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L145-L160
[ "def", "cast_scalar_indexer", "(", "val", ")", ":", "# assumes lib.is_scalar(val)", "if", "lib", ".", "is_float", "(", "val", ")", "and", "val", "==", "int", "(", "val", ")", ":", "return", "int", "(", "val", ")", "return", "val" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
index_labels_to_array
Transform label or iterable of labels to array, for use in Index. Parameters ---------- dtype : dtype If specified, use as dtype of the resulting array, otherwise infer. Returns ------- array
pandas/core/common.py
def index_labels_to_array(labels, dtype=None): """ Transform label or iterable of labels to array, for use in Index. Parameters ---------- dtype : dtype If specified, use as dtype of the resulting array, otherwise infer. Returns ------- array """ if isinstance(labels, (...
def index_labels_to_array(labels, dtype=None): """ Transform label or iterable of labels to array, for use in Index. Parameters ---------- dtype : dtype If specified, use as dtype of the resulting array, otherwise infer. Returns ------- array """ if isinstance(labels, (...
[ "Transform", "label", "or", "iterable", "of", "labels", "to", "array", "for", "use", "in", "Index", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L259-L283
[ "def", "index_labels_to_array", "(", "labels", ",", "dtype", "=", "None", ")", ":", "if", "isinstance", "(", "labels", ",", "(", "str", ",", "tuple", ")", ")", ":", "labels", "=", "[", "labels", "]", "if", "not", "isinstance", "(", "labels", ",", "("...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_null_slice
We have a null slice.
pandas/core/common.py
def is_null_slice(obj): """ We have a null slice. """ return (isinstance(obj, slice) and obj.start is None and obj.stop is None and obj.step is None)
def is_null_slice(obj): """ We have a null slice. """ return (isinstance(obj, slice) and obj.start is None and obj.stop is None and obj.step is None)
[ "We", "have", "a", "null", "slice", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L292-L297
[ "def", "is_null_slice", "(", "obj", ")", ":", "return", "(", "isinstance", "(", "obj", ",", "slice", ")", "and", "obj", ".", "start", "is", "None", "and", "obj", ".", "stop", "is", "None", "and", "obj", ".", "step", "is", "None", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
is_full_slice
We have a full length slice.
pandas/core/common.py
def is_full_slice(obj, l): """ We have a full length slice. """ return (isinstance(obj, slice) and obj.start == 0 and obj.stop == l and obj.step is None)
def is_full_slice(obj, l): """ We have a full length slice. """ return (isinstance(obj, slice) and obj.start == 0 and obj.stop == l and obj.step is None)
[ "We", "have", "a", "full", "length", "slice", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L308-L313
[ "def", "is_full_slice", "(", "obj", ",", "l", ")", ":", "return", "(", "isinstance", "(", "obj", ",", "slice", ")", "and", "obj", ".", "start", "==", "0", "and", "obj", ".", "stop", "==", "l", "and", "obj", ".", "step", "is", "None", ")" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
apply_if_callable
Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs
pandas/core/common.py
def apply_if_callable(maybe_callable, obj, **kwargs): """ Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs """ if callable(maybe_callable): ...
def apply_if_callable(maybe_callable, obj, **kwargs): """ Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs """ if callable(maybe_callable): ...
[ "Evaluate", "possibly", "callable", "input", "using", "obj", "and", "kwargs", "if", "it", "is", "callable", "otherwise", "return", "as", "it", "is", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L333-L348
[ "def", "apply_if_callable", "(", "maybe_callable", ",", "obj", ",", "*", "*", "kwargs", ")", ":", "if", "callable", "(", "maybe_callable", ")", ":", "return", "maybe_callable", "(", "obj", ",", "*", "*", "kwargs", ")", "return", "maybe_callable" ]
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
standardize_mapping
Helper function to standardize a supplied mapping. .. versionadded:: 0.21.0 Parameters ---------- into : instance or subclass of collections.abc.Mapping Must be a class, an initialized collections.defaultdict, or an instance of a collections.abc.Mapping subclass. Returns -----...
pandas/core/common.py
def standardize_mapping(into): """ Helper function to standardize a supplied mapping. .. versionadded:: 0.21.0 Parameters ---------- into : instance or subclass of collections.abc.Mapping Must be a class, an initialized collections.defaultdict, or an instance of a collections.a...
def standardize_mapping(into): """ Helper function to standardize a supplied mapping. .. versionadded:: 0.21.0 Parameters ---------- into : instance or subclass of collections.abc.Mapping Must be a class, an initialized collections.defaultdict, or an instance of a collections.a...
[ "Helper", "function", "to", "standardize", "a", "supplied", "mapping", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L368-L401
[ "def", "standardize_mapping", "(", "into", ")", ":", "if", "not", "inspect", ".", "isclass", "(", "into", ")", ":", "if", "isinstance", "(", "into", ",", "collections", ".", "defaultdict", ")", ":", "return", "partial", "(", "collections", ".", "defaultdic...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
random_state
Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. If receives `None`, returns np.rand...
pandas/core/common.py
def random_state(state=None): """ Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. ...
def random_state(state=None): """ Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. ...
[ "Helper", "function", "for", "processing", "random_state", "arguments", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L404-L430
[ "def", "random_state", "(", "state", "=", "None", ")", ":", "if", "is_integer", "(", "state", ")", ":", "return", "np", ".", "random", ".", "RandomState", "(", "state", ")", "elif", "isinstance", "(", "state", ",", "np", ".", "random", ".", "RandomStat...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_pipe
Apply a function ``func`` to object ``obj`` either by passing obj as the first argument to the function or, in the case that the func is a tuple, interpret the first element of the tuple as a function and pass the obj to that function as a keyword argument whose key is the value of the second element of...
pandas/core/common.py
def _pipe(obj, func, *args, **kwargs): """ Apply a function ``func`` to object ``obj`` either by passing obj as the first argument to the function or, in the case that the func is a tuple, interpret the first element of the tuple as a function and pass the obj to that function as a keyword argument ...
def _pipe(obj, func, *args, **kwargs): """ Apply a function ``func`` to object ``obj`` either by passing obj as the first argument to the function or, in the case that the func is a tuple, interpret the first element of the tuple as a function and pass the obj to that function as a keyword argument ...
[ "Apply", "a", "function", "func", "to", "object", "obj", "either", "by", "passing", "obj", "as", "the", "first", "argument", "to", "the", "function", "or", "in", "the", "case", "that", "the", "func", "is", "a", "tuple", "interpret", "the", "first", "elem...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L433-L465
[ "def", "_pipe", "(", "obj", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "func", ",", "tuple", ")", ":", "func", ",", "target", "=", "func", "if", "target", "in", "kwargs", ":", "msg", "=", "'%s is bo...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_rename_function
Returns a function that will map names/labels, dependent if mapper is a dict, Series or just a function.
pandas/core/common.py
def _get_rename_function(mapper): """ Returns a function that will map names/labels, dependent if mapper is a dict, Series or just a function. """ if isinstance(mapper, (abc.Mapping, ABCSeries)): def f(x): if x in mapper: return mapper[x] else: ...
def _get_rename_function(mapper): """ Returns a function that will map names/labels, dependent if mapper is a dict, Series or just a function. """ if isinstance(mapper, (abc.Mapping, ABCSeries)): def f(x): if x in mapper: return mapper[x] else: ...
[ "Returns", "a", "function", "that", "will", "map", "names", "/", "labels", "dependent", "if", "mapper", "is", "a", "dict", "Series", "or", "just", "a", "function", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L468-L483
[ "def", "_get_rename_function", "(", "mapper", ")", ":", "if", "isinstance", "(", "mapper", ",", "(", "abc", ".", "Mapping", ",", "ABCSeries", ")", ")", ":", "def", "f", "(", "x", ")", ":", "if", "x", "in", "mapper", ":", "return", "mapper", "[", "x...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_fill_value
return the correct fill value for the dtype of the values
pandas/core/nanops.py
def _get_fill_value(dtype, fill_value=None, fill_value_typ=None): """ return the correct fill value for the dtype of the values """ if fill_value is not None: return fill_value if _na_ok_dtype(dtype): if fill_value_typ is None: return np.nan else: if fill_valu...
def _get_fill_value(dtype, fill_value=None, fill_value_typ=None): """ return the correct fill value for the dtype of the values """ if fill_value is not None: return fill_value if _na_ok_dtype(dtype): if fill_value_typ is None: return np.nan else: if fill_valu...
[ "return", "the", "correct", "fill", "value", "for", "the", "dtype", "of", "the", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L180-L200
[ "def", "_get_fill_value", "(", "dtype", ",", "fill_value", "=", "None", ",", "fill_value_typ", "=", "None", ")", ":", "if", "fill_value", "is", "not", "None", ":", "return", "fill_value", "if", "_na_ok_dtype", "(", "dtype", ")", ":", "if", "fill_value_typ", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_values
utility to get the values view, mask, dtype if necessary copy and mask using the specified fill_value copy = True will force the copy
pandas/core/nanops.py
def _get_values(values, skipna, fill_value=None, fill_value_typ=None, isfinite=False, copy=True, mask=None): """ utility to get the values view, mask, dtype if necessary copy and mask using the specified fill_value copy = True will force the copy """ if is_datetime64tz_dtype(values)...
def _get_values(values, skipna, fill_value=None, fill_value_typ=None, isfinite=False, copy=True, mask=None): """ utility to get the values view, mask, dtype if necessary copy and mask using the specified fill_value copy = True will force the copy """ if is_datetime64tz_dtype(values)...
[ "utility", "to", "get", "the", "values", "view", "mask", "dtype", "if", "necessary", "copy", "and", "mask", "using", "the", "specified", "fill_value", "copy", "=", "True", "will", "force", "the", "copy" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L203-L258
[ "def", "_get_values", "(", "values", ",", "skipna", ",", "fill_value", "=", "None", ",", "fill_value_typ", "=", "None", ",", "isfinite", "=", "False", ",", "copy", "=", "True", ",", "mask", "=", "None", ")", ":", "if", "is_datetime64tz_dtype", "(", "valu...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_wrap_results
wrap our results if needed
pandas/core/nanops.py
def _wrap_results(result, dtype, fill_value=None): """ wrap our results if needed """ if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype): if fill_value is None: # GH#24293 fill_value = iNaT if not isinstance(result, np.ndarray): tz = getattr(dtype,...
def _wrap_results(result, dtype, fill_value=None): """ wrap our results if needed """ if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype): if fill_value is None: # GH#24293 fill_value = iNaT if not isinstance(result, np.ndarray): tz = getattr(dtype,...
[ "wrap", "our", "results", "if", "needed" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L276-L304
[ "def", "_wrap_results", "(", "result", ",", "dtype", ",", "fill_value", "=", "None", ")", ":", "if", "is_datetime64_dtype", "(", "dtype", ")", "or", "is_datetime64tz_dtype", "(", "dtype", ")", ":", "if", "fill_value", "is", "None", ":", "# GH#24293", "fill_v...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_na_for_min_count
Return the missing value for `values` Parameters ---------- values : ndarray axis : int or None axis for the reduction Returns ------- result : scalar or ndarray For 1-D values, returns a scalar of the correct missing type. For 2-D values, returns a 1-D array where ...
pandas/core/nanops.py
def _na_for_min_count(values, axis): """Return the missing value for `values` Parameters ---------- values : ndarray axis : int or None axis for the reduction Returns ------- result : scalar or ndarray For 1-D values, returns a scalar of the correct missing type. ...
def _na_for_min_count(values, axis): """Return the missing value for `values` Parameters ---------- values : ndarray axis : int or None axis for the reduction Returns ------- result : scalar or ndarray For 1-D values, returns a scalar of the correct missing type. ...
[ "Return", "the", "missing", "value", "for", "values" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L307-L334
[ "def", "_na_for_min_count", "(", "values", ",", "axis", ")", ":", "# we either return np.nan or pd.NaT", "if", "is_numeric_dtype", "(", "values", ")", ":", "values", "=", "values", ".", "astype", "(", "'float64'", ")", "fill_value", "=", "na_value_for_dtype", "(",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanany
Check if any elements along an axis evaluate to True. Parameters ---------- values : ndarray axis : int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : bool Examples -------- >>> import pandas.core...
pandas/core/nanops.py
def nanany(values, axis=None, skipna=True, mask=None): """ Check if any elements along an axis evaluate to True. Parameters ---------- values : ndarray axis : int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- ...
def nanany(values, axis=None, skipna=True, mask=None): """ Check if any elements along an axis evaluate to True. Parameters ---------- values : ndarray axis : int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- ...
[ "Check", "if", "any", "elements", "along", "an", "axis", "evaluate", "to", "True", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L337-L367
[ "def", "nanany", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "False", ","...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanall
Check if all elements along an axis evaluate to True. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : bool Examples -------- >>> import pandas.core....
pandas/core/nanops.py
def nanall(values, axis=None, skipna=True, mask=None): """ Check if all elements along an axis evaluate to True. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- r...
def nanall(values, axis=None, skipna=True, mask=None): """ Check if all elements along an axis evaluate to True. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- r...
[ "Check", "if", "all", "elements", "along", "an", "axis", "evaluate", "to", "True", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L370-L400
[ "def", "nanall", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "True", ",",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nansum
Sum the elements along an axis ignoring NaNs Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : dtype Examples -------...
pandas/core/nanops.py
def nansum(values, axis=None, skipna=True, min_count=0, mask=None): """ Sum the elements along an axis ignoring NaNs Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mas...
def nansum(values, axis=None, skipna=True, min_count=0, mask=None): """ Sum the elements along an axis ignoring NaNs Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mas...
[ "Sum", "the", "elements", "along", "an", "axis", "ignoring", "NaNs" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L404-L438
[ "def", "nansum", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "min_count", "=", "0", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "dtype_max", ",", "_", "=", "_get_values", "(", "values"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanmean
Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in which...
pandas/core/nanops.py
def nanmean(values, axis=None, skipna=True, mask=None): """ Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------...
def nanmean(values, axis=None, skipna=True, mask=None): """ Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------...
[ "Compute", "the", "mean", "of", "the", "element", "along", "an", "axis", "ignoring", "NaNs" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L443-L491
[ "def", "nanmean", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "dtype_max", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "0", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanmedian
Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in which case use the same precision as the input array. Exa...
pandas/core/nanops.py
def nanmedian(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in ...
def nanmedian(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in ...
[ "Parameters", "----------", "values", ":", "ndarray", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", "mask", "if", "known" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L496-L558
[ "def", "nanmedian", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "def", "get_median", "(", "x", ")", ":", "mask", "=", "notna", "(", "x", ")", "if", "not", "skipna", "and", "not", "mask"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanstd
Compute the standard deviation along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number ...
pandas/core/nanops.py
def nanstd(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard deviation along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divis...
def nanstd(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard deviation along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divis...
[ "Compute", "the", "standard", "deviation", "along", "given", "axis", "while", "ignoring", "NaNs" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L581-L611
[ "def", "nanstd", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "ddof", "=", "1", ",", "mask", "=", "None", ")", ":", "result", "=", "np", ".", "sqrt", "(", "nanvar", "(", "values", ",", "axis", "=", "axis", ",", "ski...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanvar
Compute the variance along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of element...
pandas/core/nanops.py
def nanvar(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the variance along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in...
def nanvar(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the variance along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in...
[ "Compute", "the", "variance", "along", "given", "axis", "while", "ignoring", "NaNs" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L616-L679
[ "def", "nanvar", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "ddof", "=", "1", ",", "mask", "=", "None", ")", ":", "values", "=", "com", ".", "values_from_object", "(", "values", ")", "dtype", "=", "values", ".", "dtyp...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nansem
Compute the standard error in the mean along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the...
pandas/core/nanops.py
def nansem(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard error in the mean along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. T...
def nansem(values, axis=None, skipna=True, ddof=1, mask=None): """ Compute the standard error in the mean along given axis while ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True ddof : int, default 1 Delta Degrees of Freedom. T...
[ "Compute", "the", "standard", "error", "in", "the", "mean", "along", "given", "axis", "while", "ignoring", "NaNs" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L683-L723
[ "def", "nansem", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "ddof", "=", "1", ",", "mask", "=", "None", ")", ":", "# This checks if non-numeric-like data is passed with numeric_only=False", "# and raises a TypeError otherwise", "nanvar",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanargmax
Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of max value in specified axis or -1 in the NA case Examples -------- >>> import p...
pandas/core/nanops.py
def nanargmax(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of max value in specified...
def nanargmax(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of max value in specified...
[ "Parameters", "----------", "values", ":", "ndarray", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", "mask", "if", "known" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L756-L782
[ "def", "nanargmax", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "fill_value...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanargmin
Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of min value in specified axis or -1 in the NA case Examples -------- >>> import p...
pandas/core/nanops.py
def nanargmin(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of min value in specified...
def nanargmin(values, axis=None, skipna=True, mask=None): """ Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -------- result : int The index of min value in specified...
[ "Parameters", "----------", "values", ":", "ndarray", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", "mask", "if", "known" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L786-L812
[ "def", "nanargmin", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "_", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "fill_value...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanskew
Compute the sample skewness. The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G1. The algorithm computes this coefficient directly from the second and third central moment. Parameters ---------- values : ndarray axis: int, optional skipna : boo...
pandas/core/nanops.py
def nanskew(values, axis=None, skipna=True, mask=None): """ Compute the sample skewness. The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G1. The algorithm computes this coefficient directly from the second and third central moment. Parameters --------...
def nanskew(values, axis=None, skipna=True, mask=None): """ Compute the sample skewness. The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G1. The algorithm computes this coefficient directly from the second and third central moment. Parameters --------...
[ "Compute", "the", "sample", "skewness", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L816-L891
[ "def", "nanskew", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", "=", "com", ".", "values_from_object", "(", "values", ")", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nankurt
Compute the sample excess kurtosis The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G2, computed directly from the second and fourth central moment. Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask...
pandas/core/nanops.py
def nankurt(values, axis=None, skipna=True, mask=None): """ Compute the sample excess kurtosis The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G2, computed directly from the second and fourth central moment. Parameters ---------- values : ndar...
def nankurt(values, axis=None, skipna=True, mask=None): """ Compute the sample excess kurtosis The statistic computed here is the adjusted Fisher-Pearson standardized moment coefficient G2, computed directly from the second and fourth central moment. Parameters ---------- values : ndar...
[ "Compute", "the", "sample", "excess", "kurtosis" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L895-L980
[ "def", "nankurt", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", "=", "com", ".", "values_from_object", "(", "values", ")", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanprod
Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : dtype Examples -------- >>> import pandas.core.nanops as nanops ...
pandas/core/nanops.py
def nanprod(values, axis=None, skipna=True, min_count=0, mask=None): """ Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : ...
def nanprod(values, axis=None, skipna=True, min_count=0, mask=None): """ Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : ...
[ "Parameters", "----------", "values", ":", "ndarray", "[", "dtype", "]", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "min_count", ":", "int", "default", "0", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", ...
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L984-L1016
[ "def", "nanprod", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "min_count", "=", "0", ",", "mask", "=", "None", ")", ":", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(", "values", ")", "if", "skipna", "and"...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nancorr
a, b: ndarrays
pandas/core/nanops.py
def nancorr(a, b, method='pearson', min_periods=None): """ a, b: ndarrays """ if len(a) != len(b): raise AssertionError('Operands to nancorr must have same size') if min_periods is None: min_periods = 1 valid = notna(a) & notna(b) if not valid.all(): a = a[valid] ...
def nancorr(a, b, method='pearson', min_periods=None): """ a, b: ndarrays """ if len(a) != len(b): raise AssertionError('Operands to nancorr must have same size') if min_periods is None: min_periods = 1 valid = notna(a) & notna(b) if not valid.all(): a = a[valid] ...
[ "a", "b", ":", "ndarrays" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L1083-L1102
[ "def", "nancorr", "(", "a", ",", "b", ",", "method", "=", "'pearson'", ",", "min_periods", "=", "None", ")", ":", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", ":", "raise", "AssertionError", "(", "'Operands to nancorr must have same size'", ")...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_nanpercentile_1d
Wraper for np.percentile that skips missing values, specialized to 1-dimensional case. Parameters ---------- values : array over which to find quantiles mask : ndarray[bool] locations in values that should be considered missing q : scalar or array of quantile indices to find na_valu...
pandas/core/nanops.py
def _nanpercentile_1d(values, mask, q, na_value, interpolation): """ Wraper for np.percentile that skips missing values, specialized to 1-dimensional case. Parameters ---------- values : array over which to find quantiles mask : ndarray[bool] locations in values that should be consi...
def _nanpercentile_1d(values, mask, q, na_value, interpolation): """ Wraper for np.percentile that skips missing values, specialized to 1-dimensional case. Parameters ---------- values : array over which to find quantiles mask : ndarray[bool] locations in values that should be consi...
[ "Wraper", "for", "np", ".", "percentile", "that", "skips", "missing", "values", "specialized", "to", "1", "-", "dimensional", "case", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L1203-L1232
[ "def", "_nanpercentile_1d", "(", "values", ",", "mask", ",", "q", ",", "na_value", ",", "interpolation", ")", ":", "# mask is Union[ExtensionArray, ndarray]", "values", "=", "values", "[", "~", "mask", "]", "if", "len", "(", "values", ")", "==", "0", ":", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
nanpercentile
Wraper for np.percentile that skips missing values. Parameters ---------- values : array over which to find quantiles q : scalar or array of quantile indices to find axis : {0, 1} na_value : scalar value to return for empty or all-null values mask : ndarray[bool] locations i...
pandas/core/nanops.py
def nanpercentile(values, q, axis, na_value, mask, ndim, interpolation): """ Wraper for np.percentile that skips missing values. Parameters ---------- values : array over which to find quantiles q : scalar or array of quantile indices to find axis : {0, 1} na_value : scalar valu...
def nanpercentile(values, q, axis, na_value, mask, ndim, interpolation): """ Wraper for np.percentile that skips missing values. Parameters ---------- values : array over which to find quantiles q : scalar or array of quantile indices to find axis : {0, 1} na_value : scalar valu...
[ "Wraper", "for", "np", ".", "percentile", "that", "skips", "missing", "values", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L1235-L1272
[ "def", "nanpercentile", "(", "values", ",", "q", ",", "axis", ",", "na_value", ",", "mask", ",", "ndim", ",", "interpolation", ")", ":", "if", "not", "lib", ".", "is_scalar", "(", "mask", ")", "and", "mask", ".", "any", "(", ")", ":", "if", "ndim",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
HTMLFormatter.write_th
Method for writting a formatted <th> cell. If col_space is set on the formatter then that is used for the value of min-width. Parameters ---------- s : object The data to be written inside the cell. header : boolean, default False Set to True if ...
pandas/io/formats/html.py
def write_th(self, s, header=False, indent=0, tags=None): """ Method for writting a formatted <th> cell. If col_space is set on the formatter then that is used for the value of min-width. Parameters ---------- s : object The data to be written inside...
def write_th(self, s, header=False, indent=0, tags=None): """ Method for writting a formatted <th> cell. If col_space is set on the formatter then that is used for the value of min-width. Parameters ---------- s : object The data to be written inside...
[ "Method", "for", "writting", "a", "formatted", "<th", ">", "cell", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/html.py#L90-L118
[ "def", "write_th", "(", "self", ",", "s", ",", "header", "=", "False", ",", "indent", "=", "0", ",", "tags", "=", "None", ")", ":", "if", "header", "and", "self", ".", "fmt", ".", "col_space", "is", "not", "None", ":", "tags", "=", "(", "tags", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
read_clipboard
r""" Read text from clipboard and pass to read_csv. See read_csv for the full argument list Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespace characters. Returns ------- parsed : DataFrame
pandas/io/clipboards.py
def read_clipboard(sep=r'\s+', **kwargs): # pragma: no cover r""" Read text from clipboard and pass to read_csv. See read_csv for the full argument list Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespa...
def read_clipboard(sep=r'\s+', **kwargs): # pragma: no cover r""" Read text from clipboard and pass to read_csv. See read_csv for the full argument list Parameters ---------- sep : str, default '\s+' A string or regex delimiter. The default of '\s+' denotes one or more whitespa...
[ "r", "Read", "text", "from", "clipboard", "and", "pass", "to", "read_csv", ".", "See", "read_csv", "for", "the", "full", "argument", "list" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/clipboards.py#L10-L72
[ "def", "read_clipboard", "(", "sep", "=", "r'\\s+'", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "encoding", "=", "kwargs", ".", "pop", "(", "'encoding'", ",", "'utf-8'", ")", "# only utf-8 is valid for passed value because that's what clipboard", "# supp...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
to_clipboard
Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : boolean, defaults to True if True, use the provided separator, writing in a csv ...
pandas/io/clipboards.py
def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover """ Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : boolean, de...
def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover """ Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : boolean, de...
[ "Attempt", "to", "write", "text", "representation", "of", "object", "to", "the", "system", "clipboard", "The", "clipboard", "can", "be", "then", "pasted", "into", "Excel", "for", "example", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/clipboards.py#L75-L132
[ "def", "to_clipboard", "(", "obj", ",", "excel", "=", "True", ",", "sep", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "encoding", "=", "kwargs", ".", "pop", "(", "'encoding'", ",", "'utf-8'", ")", "# testing if an invalid encoding i...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_get_skiprows
Get an iterator given an integer, slice or container. Parameters ---------- skiprows : int, slice, container The iterator to use to skip rows; can also be a slice. Raises ------ TypeError * If `skiprows` is not a slice, integer, or Container Returns ------- it : it...
pandas/io/html.py
def _get_skiprows(skiprows): """Get an iterator given an integer, slice or container. Parameters ---------- skiprows : int, slice, container The iterator to use to skip rows; can also be a slice. Raises ------ TypeError * If `skiprows` is not a slice, integer, or Container ...
def _get_skiprows(skiprows): """Get an iterator given an integer, slice or container. Parameters ---------- skiprows : int, slice, container The iterator to use to skip rows; can also be a slice. Raises ------ TypeError * If `skiprows` is not a slice, integer, or Container ...
[ "Get", "an", "iterator", "given", "an", "integer", "slice", "or", "container", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L85-L110
[ "def", "_get_skiprows", "(", "skiprows", ")", ":", "if", "isinstance", "(", "skiprows", ",", "slice", ")", ":", "return", "lrange", "(", "skiprows", ".", "start", "or", "0", ",", "skiprows", ".", "stop", ",", "skiprows", ".", "step", "or", "1", ")", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_read
Try to read from a url, file or string. Parameters ---------- obj : str, unicode, or file-like Returns ------- raw_text : str
pandas/io/html.py
def _read(obj): """Try to read from a url, file or string. Parameters ---------- obj : str, unicode, or file-like Returns ------- raw_text : str """ if _is_url(obj): with urlopen(obj) as url: text = url.read() elif hasattr(obj, 'read'): text = obj.re...
def _read(obj): """Try to read from a url, file or string. Parameters ---------- obj : str, unicode, or file-like Returns ------- raw_text : str """ if _is_url(obj): with urlopen(obj) as url: text = url.read() elif hasattr(obj, 'read'): text = obj.re...
[ "Try", "to", "read", "from", "a", "url", "file", "or", "string", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L113-L139
[ "def", "_read", "(", "obj", ")", ":", "if", "_is_url", "(", "obj", ")", ":", "with", "urlopen", "(", "obj", ")", "as", "url", ":", "text", "=", "url", ".", "read", "(", ")", "elif", "hasattr", "(", "obj", ",", "'read'", ")", ":", "text", "=", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_build_xpath_expr
Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : unicode An XPath expression th...
pandas/io/html.py
def _build_xpath_expr(attrs): """Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : u...
def _build_xpath_expr(attrs): """Build an xpath expression to simulate bs4's ability to pass in kwargs to search for attributes when using the lxml parser. Parameters ---------- attrs : dict A dict of HTML attributes. These are NOT checked for validity. Returns ------- expr : u...
[ "Build", "an", "xpath", "expression", "to", "simulate", "bs4", "s", "ability", "to", "pass", "in", "kwargs", "to", "search", "for", "attributes", "when", "using", "the", "lxml", "parser", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L601-L620
[ "def", "_build_xpath_expr", "(", "attrs", ")", ":", "# give class attribute as class_ because class is a python keyword", "if", "'class_'", "in", "attrs", ":", "attrs", "[", "'class'", "]", "=", "attrs", ".", "pop", "(", "'class_'", ")", "s", "=", "[", "\"@{key}={...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_parser_dispatch
Choose the parser based on the input flavor. Parameters ---------- flavor : str The type of parser to use. This must be a valid backend. Returns ------- cls : _HtmlFrameParser subclass The parser class based on the requested input flavor. Raises ------ ValueError ...
pandas/io/html.py
def _parser_dispatch(flavor): """Choose the parser based on the input flavor. Parameters ---------- flavor : str The type of parser to use. This must be a valid backend. Returns ------- cls : _HtmlFrameParser subclass The parser class based on the requested input flavor. ...
def _parser_dispatch(flavor): """Choose the parser based on the input flavor. Parameters ---------- flavor : str The type of parser to use. This must be a valid backend. Returns ------- cls : _HtmlFrameParser subclass The parser class based on the requested input flavor. ...
[ "Choose", "the", "parser", "based", "on", "the", "input", "flavor", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L806-L846
[ "def", "_parser_dispatch", "(", "flavor", ")", ":", "valid_parsers", "=", "list", "(", "_valid_parsers", ".", "keys", "(", ")", ")", "if", "flavor", "not", "in", "valid_parsers", ":", "raise", "ValueError", "(", "'{invalid!r} is not a valid flavor, valid flavors '",...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
read_html
r"""Read HTML tables into a ``list`` of ``DataFrame`` objects. Parameters ---------- io : str or file-like A URL, a file-like object, or a raw string containing HTML. Note that lxml only accepts the http, ftp and file url protocols. If you have a URL that starts with ``'https'`` you...
pandas/io/html.py
def read_html(io, match='.+', flavor=None, header=None, index_col=None, skiprows=None, attrs=None, parse_dates=False, tupleize_cols=None, thousands=',', encoding=None, decimal='.', converters=None, na_values=None, keep_default_na=True, displayed_only=True): r"...
def read_html(io, match='.+', flavor=None, header=None, index_col=None, skiprows=None, attrs=None, parse_dates=False, tupleize_cols=None, thousands=',', encoding=None, decimal='.', converters=None, na_values=None, keep_default_na=True, displayed_only=True): r"...
[ "r", "Read", "HTML", "tables", "into", "a", "list", "of", "DataFrame", "objects", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L921-L1088
[ "def", "read_html", "(", "io", ",", "match", "=", "'.+'", ",", "flavor", "=", "None", ",", "header", "=", "None", ",", "index_col", "=", "None", ",", "skiprows", "=", "None", ",", "attrs", "=", "None", ",", "parse_dates", "=", "False", ",", "tupleize...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_HtmlFrameParser.parse_tables
Parse and return all tables from the DOM. Returns ------- list of parsed (header, body, footer) tuples from tables.
pandas/io/html.py
def parse_tables(self): """ Parse and return all tables from the DOM. Returns ------- list of parsed (header, body, footer) tuples from tables. """ tables = self._parse_tables(self._build_doc(), self.match, self.attrs) return (self._parse_thead_tbody_tfoo...
def parse_tables(self): """ Parse and return all tables from the DOM. Returns ------- list of parsed (header, body, footer) tuples from tables. """ tables = self._parse_tables(self._build_doc(), self.match, self.attrs) return (self._parse_thead_tbody_tfoo...
[ "Parse", "and", "return", "all", "tables", "from", "the", "DOM", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L208-L217
[ "def", "parse_tables", "(", "self", ")", ":", "tables", "=", "self", ".", "_parse_tables", "(", "self", ".", "_build_doc", "(", ")", ",", "self", ".", "match", ",", "self", ".", "attrs", ")", "return", "(", "self", ".", "_parse_thead_tbody_tfoot", "(", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_HtmlFrameParser._parse_thead_tbody_tfoot
Given a table, return parsed header, body, and foot. Parameters ---------- table_html : node-like Returns ------- tuple of (header, body, footer), each a list of list-of-text rows. Notes ----- Header and body are lists-of-lists. Top level list i...
pandas/io/html.py
def _parse_thead_tbody_tfoot(self, table_html): """ Given a table, return parsed header, body, and foot. Parameters ---------- table_html : node-like Returns ------- tuple of (header, body, footer), each a list of list-of-text rows. Notes ...
def _parse_thead_tbody_tfoot(self, table_html): """ Given a table, return parsed header, body, and foot. Parameters ---------- table_html : node-like Returns ------- tuple of (header, body, footer), each a list of list-of-text rows. Notes ...
[ "Given", "a", "table", "return", "parsed", "header", "body", "and", "foot", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L375-L420
[ "def", "_parse_thead_tbody_tfoot", "(", "self", ",", "table_html", ")", ":", "header_rows", "=", "self", ".", "_parse_thead_tr", "(", "table_html", ")", "body_rows", "=", "self", ".", "_parse_tbody_tr", "(", "table_html", ")", "footer_rows", "=", "self", ".", ...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_HtmlFrameParser._expand_colspan_rowspan
Given a list of <tr>s, return a list of text rows. Parameters ---------- rows : list of node-like List of <tr>s Returns ------- list of list Each returned row is a list of str text. Notes ----- Any cell with ``rowspan`` o...
pandas/io/html.py
def _expand_colspan_rowspan(self, rows): """ Given a list of <tr>s, return a list of text rows. Parameters ---------- rows : list of node-like List of <tr>s Returns ------- list of list Each returned row is a list of str text. ...
def _expand_colspan_rowspan(self, rows): """ Given a list of <tr>s, return a list of text rows. Parameters ---------- rows : list of node-like List of <tr>s Returns ------- list of list Each returned row is a list of str text. ...
[ "Given", "a", "list", "of", "<tr", ">", "s", "return", "a", "list", "of", "text", "rows", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L422-L496
[ "def", "_expand_colspan_rowspan", "(", "self", ",", "rows", ")", ":", "all_texts", "=", "[", "]", "# list of rows, each a list of str", "remainder", "=", "[", "]", "# list of (index, text, nrows)", "for", "tr", "in", "rows", ":", "texts", "=", "[", "]", "# the o...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_HtmlFrameParser._handle_hidden_tables
Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Name of the accessor for retrieving HTML attributes Returns ...
pandas/io/html.py
def _handle_hidden_tables(self, tbl_list, attr_name): """ Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Nam...
def _handle_hidden_tables(self, tbl_list, attr_name): """ Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Nam...
[ "Return", "list", "of", "tables", "potentially", "removing", "hidden", "elements" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L498-L518
[ "def", "_handle_hidden_tables", "(", "self", ",", "tbl_list", ",", "attr_name", ")", ":", "if", "not", "self", ".", "displayed_only", ":", "return", "tbl_list", "return", "[", "x", "for", "x", "in", "tbl_list", "if", "\"display:none\"", "not", "in", "getattr...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
_LxmlFrameParser._build_doc
Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet connection will fail. See...
pandas/io/html.py
def _build_doc(self): """ Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet ...
def _build_doc(self): """ Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet ...
[ "Raises", "------", "ValueError", "*", "If", "a", "URL", "that", "lxml", "cannot", "parse", "is", "passed", "." ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L690-L735
[ "def", "_build_doc", "(", "self", ")", ":", "from", "lxml", ".", "html", "import", "parse", ",", "fromstring", ",", "HTMLParser", "from", "lxml", ".", "etree", "import", "XMLSyntaxError", "parser", "=", "HTMLParser", "(", "recover", "=", "True", ",", "enco...
9feb3ad92cc0397a04b665803a49299ee7aa1037
train
get_dtype_kinds
Parameters ---------- l : list of arrays Returns ------- a set of kinds that exist in this list of arrays
pandas/core/dtypes/concat.py
def get_dtype_kinds(l): """ Parameters ---------- l : list of arrays Returns ------- a set of kinds that exist in this list of arrays """ typs = set() for arr in l: dtype = arr.dtype if is_categorical_dtype(dtype): typ = 'category' elif is_s...
def get_dtype_kinds(l): """ Parameters ---------- l : list of arrays Returns ------- a set of kinds that exist in this list of arrays """ typs = set() for arr in l: dtype = arr.dtype if is_categorical_dtype(dtype): typ = 'category' elif is_s...
[ "Parameters", "----------", "l", ":", "list", "of", "arrays" ]
pandas-dev/pandas
python
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/concat.py#L18-L56
[ "def", "get_dtype_kinds", "(", "l", ")", ":", "typs", "=", "set", "(", ")", "for", "arr", "in", "l", ":", "dtype", "=", "arr", ".", "dtype", "if", "is_categorical_dtype", "(", "dtype", ")", ":", "typ", "=", "'category'", "elif", "is_sparse", "(", "ar...
9feb3ad92cc0397a04b665803a49299ee7aa1037