module numbers.weighted_dataframe
¶
Short summary¶
module cpyquickhelper.numbers.weighted_dataframe
Addition for pandas.
Classes¶
class |
truncated documentation |
---|---|
Implements an array holding @see WeightedDouble numbers. This leverages a new concept introduced in pandas 0.24 … |
|
Extends pandas with new accessor for series based on @see cl WeightedDouble. |
|
Implements a series holding @see WeightedDouble numbers. Does not add anything to Series. |
|
Defines a custom type for a @see cl WeightedSeries. |
Properties¶
property |
truncated documentation |
---|---|
|
|
|
Can arrays of this dtype hold NA values? |
|
|
|
Used when a manipulation result has one higher dimension as the original, such as Series.to_frame() |
|
|
|
Equivalent to self.isna().any(). Some ExtensionArray subclasses may be able to optimize this check. |
|
|
|
Whether this dtype should be considered boolean. By default, ExtensionDtypes are assumed to be non-numeric. … |
|
Return boolean indicating if self is cached or not. |
|
|
|
Whether columns with this dtype should be considered numeric. By default ExtensionDtypes are assumed to be non-numeric. … |
|
Return boolean indicating if self is view of another array |
|
|
|
|
|
Return the internal repr of this data (defined by Block.interval_values). This are the values as stored in the Block … |
|
The ExtensionArray of the data backing this Series or Index. Returns ——- ExtensionArray An ExtensionArray of the … |
|
Access a single value for a row/column label pair. Similar to |
|
Dictionary of global attributes of this dataset. |
|
Return a list of the row axis labels. |
Returns @see cl WeightedSeriesDtype. |
|
|
Return the dtype object of the underlying data. Examples ——– >>> s = pd.Series([1, 2, 3]) … |
|
Return the dtype object of the underlying data. Examples ——– >>> s = pd.Series([1, 2, 3]) … |
|
|
|
Get the properties associated with this pandas object. The available flags are |
|
Return True if there are any NaNs. Enables various performance speedups. Returns ——- … |
|
Access a single value for a row/column pair by integer position. Similar to |
|
Purely integer-location based indexing for selection by position. |
|
Return boolean if values in the object are monotonically decreasing. Returns ——- bool |
|
Return boolean if values in the object are monotonically increasing. Returns ——- bool |
|
Return boolean if values in the object are unique. Returns ——- bool |
A character code (one of ‘biufcmMOSUV’), default ‘O’ This should match the NumPy dtype used when the array is … |
|
|
Access a group of rows and columns by label(s) or a boolean array. |
|
Default NA value to use for this type. This is used in e.g. ExtensionArray.take. This should be the user-facing … |
A string identifying the data type. Will be used for display in, e.g. |
|
|
Return the name of the Series. The name of a Series becomes its index or column name if it is used to form … |
A string identifying the data type. Will be used for display in, e.g. |
|
|
Ordered list of field names, or None if there are no fields. This is for compatibility with NumPy arrays, and may … |
|
Return the number of bytes in the underlying data. |
|
Number of dimensions of the underlying data, by definition 1. |
|
Return a tuple of the shape of the underlying data. Examples ——– >>> s = pd.Series([1, 2, … |
|
Return the number of elements in the underlying data. |
|
Return the transpose, which is by definition self. |
The scalar type for the array, e.g. |
|
Returns the values. |
|
|
Return Series as ndarray or ndarray-like depending on the dtype. |
Returns the weights. |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Concatenate multiple array Parameters ———- to_concat : sequence of this type Returns … |
|
Return the array type associated with this dtype. Returns ——- type |
|
Attempt to construct this type from a string. Parameters ———- string : str Returns … |
Methods¶
method |
truncated documentation |
---|---|
Addition |
|
Tries first to see if class Series has this attribute and then tries @see cl WeightedDoubleAccessor. |
|
Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype. |
|
Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype. |
|
Multiplication |
|
usual |
|
usual |
|
Soustraction |
|
Division |
|
is nan? |
|
Tells if values are missing. |
Documentation¶
@file @brief Addition for pandas.
- class cpyquickhelper.numbers.weighted_dataframe.WeightedArray(*args, **kwargs)¶
Bases:
PandasArray
Implements an array holding @see WeightedDouble numbers. This leverages a new concept introduced in pandas 0.24 implemented in class PandasArray. It can be used to define a new column type in a dataframe.
Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype.
- __abstractmethods__ = frozenset({})¶
- __add__(other)¶
Addition
- __init__(*args, **kwargs)¶
Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype.
- __mul__(other)¶
Multiplication
- __sub__(other)¶
Soustraction
- __truediv__(other)¶
Division
- _abc_impl = <_abc._abc_data object>¶
- classmethod _concat_same_type(to_concat: Sequence[ExtensionArrayT]) ExtensionArrayT ¶
Concatenate multiple array
Parameters¶
to_concat : sequence of this type
Returns¶
@see cl WeightedArray
- classmethod _from_sequence(scalars, *, dtype=None, copy=False)¶
Construct a new ExtensionArray from a sequence of scalars.
Parameters¶
- scalarsSequence
Each element will be an instance of the scalar type for this array,
cls.dtype.type
or be converted into this type in this method.- dtypedtype, optional
Construct for this particular dtype. This should be a Dtype compatible with the ExtensionArray.
- copybool, default False
If True, copy the underlying data.
Returns¶
ExtensionArray
- property dtype¶
Returns @see cl WeightedSeriesDtype.
- isna()¶
is nan?
- property name¶
A string identifying the data type. Will be used for display in, e.g.
Series.dtype
- class cpyquickhelper.numbers.weighted_dataframe.WeightedDoubleAccessor(obj)¶
Bases:
object
Extends pandas with new accessor for series based on @see cl WeightedDouble.
- __init__(obj)¶
- __len__()¶
- _new_series(fct)¶
- isnan()¶
Tells if values are missing.
- property value¶
Returns the values.
- property weight¶
Returns the weights.
- class cpyquickhelper.numbers.weighted_dataframe.WeightedSeries(*args, **kwargs)¶
Bases:
Series
Implements a series holding @see WeightedDouble numbers. Does not add anything to Series.
Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype.
- __getattr__(attr)¶
Tries first to see if class Series has this attribute and then tries @see cl WeightedDoubleAccessor.
- __init__(*args, **kwargs)¶
Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype.
- _mgr: SingleManager¶
- _name: Hashable¶
- class cpyquickhelper.numbers.weighted_dataframe.WeightedSeriesDtype¶
Bases:
ExtensionDtype
Defines a custom type for a @see cl WeightedSeries.
- __repr__()¶
usual
- __str__()¶
usual
- classmethod construct_from_string(string)¶
Attempt to construct this type from a string. Parameters ———- string : str
Returns¶
self : instance of ‘WeightedDouble’
Raises¶
- TypeError
If a class cannot be constructed from this ‘string’.
- property kind¶
A character code (one of ‘biufcmMOSUV’), default ‘O’ This should match the NumPy dtype used when the array is converted to an ndarray, ‘O’ in this case. type.
See Also¶
numpy.dtype.kind
- property name¶
A string identifying the data type. Will be used for display in, e.g.
Series.dtype