module numbers.weighted_dataframe

Inheritance diagram of cpyquickhelper.numbers.weighted_dataframe

Short summary

module cpyquickhelper.numbers.weighted_dataframe

Addition for pandas.

source on GitHub

Classes

class

truncated documentation

WeightedArray

Implements an array holding @see WeightedDouble numbers. This leverages a new concept introduced in pandas 0.24 …

WeightedDoubleAccessor

Extends pandas with new accessor for series based on @see cl WeightedDouble.

WeightedSeries

Implements a series holding @see WeightedDouble numbers. Does not add anything to Series.

WeightedSeriesDtype

Defines a custom type for a @see cl WeightedSeries.

Properties

property

truncated documentation

_AXIS_NAMES

_AXIS_NUMBERS

_can_hold_na

_constructor

_constructor_expanddim

_constructor_sliced

Used when a manipulation result has one lower dimension(s) as the original, such as DataFrame single columns slicing. …

_data

_info_axis

_is_boolean

Whether this dtype should be considered boolean. By default, ExtensionDtypes are assumed to be non-numeric. …

_is_cached

Return boolean indicating if self is cached or not.

_is_mixed_type

_is_numeric

Whether columns with this dtype should be considered numeric. By default ExtensionDtypes are assumed to be non-numeric. …

_is_view

Return boolean indicating if self is view of another array

_obj_with_exclusions

internal compat with SelectionMixin

_selected_obj

internal compat with SelectionMixin

_selection_list

_selection_name

Return a name for myself; This would ideally be called the ‘name’ property, but we cannot conflict with …

_stat_axis

_values

Return the internal repr of this data (defined by Block.interval_values). This are the values as stored in the Block …

array

The ExtensionArray of the data backing this Series or Index.

at

Access a single value for a row/column label pair. Similar to loc, in that both provide label-based lookups. …

attrs

Dictionary of global attributes of this dataset.

axes

Return a list of the row axis labels.

dtype

Returns @see cl WeightedSeriesDtype.

dtype

Return the dtype object of the underlying data.

dtypes

Return the dtype object of the underlying data.

empty

flags

Get the properties associated with this pandas object. The available flags are

hasnans

Return if I have any nans; enables various perf speedups.

iat

Access a single value for a row/column pair by integer position. Similar to iloc, in that both provide integer-based …

iloc

Purely integer-location based indexing for selection by position. .iloc[] is primarily integer position based …

is_monotonic

Return boolean if values in the object are monotonic_increasing. Returns ——- bool

is_monotonic_decreasing

Return boolean if values in the object are monotonic_decreasing. Returns ——- bool

is_monotonic_increasing

Alias for is_monotonic.

is_unique

Return boolean if values in the object are unique. Returns ——- bool

kind

A character code (one of ‘biufcmMOSUV’), default ‘O’ This should match the NumPy dtype used when the array is …

loc

Access a group of rows and columns by label(s) or a boolean array. .loc[] is primarily label based, but may …

na_value

Default NA value to use for this type. This is used in e.g. ExtensionArray.take. This should be the user-facing …

name

A string identifying the data type. Will be used for display in, e.g. Series.dtype

name

Return the name of the Series. The name of a Series becomes its index or column name if it is used to form …

name

A string identifying the data type. Will be used for display in, e.g. Series.dtype

names

Ordered list of field names, or None if there are no fields. This is for compatibility with NumPy arrays, and may …

nbytes

Return the number of bytes in the underlying data.

ndim

Number of dimensions of the underlying data, by definition 1.

shape

shape

Return a tuple of the shape of the underlying data.

size

Return the number of elements in the underlying data.

T

T

Return the transpose, which is by definition self.

type

The scalar type for the array, e.g. int It’s expected ExtensionArray[item] returns an instance of …

value

Returns the values.

values

Return Series as ndarray or ndarray-like depending on the dtype.

weight

Returns the weights.

Static Methods

staticmethod

truncated documentation

_concat_same_type

Concatenate multiple array Parameters ———- to_concat : sequence of this type Returns …

_from_sequence

construct_array_type

Return the array type associated with this dtype. Returns ——- type

construct_from_string

Attempt to construct this type from a string. Parameters ———- string : str Returns …

Methods

method

truncated documentation

__add__

Addition

__getattr__

Tries first to see if class Series has this attribute and then tries @see cl WeightedDoubleAccessor.

__init__

Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype.

__init__

__init__

Overwrites the constructor to force dtype to be @see cl WeightedSeriesDtype.

__len__

__mul__

Multiplication

__repr__

usual

__str__

usual

__sub__

Soustraction

__truediv__

Division

_new_series

isna

is nan?

isnan

Tells if values are missing.

Documentation

@file @brief Addition for pandas.

class cpyquickhelper.numbers.weighted_dataframe.WeightedArray(*args, **kwargs)

Bases: pandas.core.arrays.numpy_.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

to_concat : sequence of this type

@see cl WeightedArray

classmethod _from_sequence(scalars, *, dtype=None, copy=False)

Construct a new ExtensionArray from a sequence of scalars.

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.

ExtensionArray

_ndarray: numpy.ndarray
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)

Initialize self. See help(type(self)) for accurate signature.

__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: pandas.core.series.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: pandas.core.internals.managers.SingleBlockManager
_name: Optional[Hashable]
class cpyquickhelper.numbers.weighted_dataframe.WeightedSeriesDtype

Bases: pandas.core.dtypes.base.ExtensionDtype

Defines a custom type for a @see cl WeightedSeries.

__repr__()

usual

__str__()

usual

classmethod construct_array_type()

Return the array type associated with this dtype.

type

classmethod construct_from_string(string)

Attempt to construct this type from a string. Parameters ———- string : str

self : instance of ‘WeightedDouble’

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.

numpy.dtype.kind

property name

A string identifying the data type. Will be used for display in, e.g. Series.dtype

property type

The scalar type for the array, e.g. int It’s expected ExtensionArray[item] returns an instance of ExtensionDtype.type for scalar item.