values
This module gathers all classes and utilities used to work with sequence of values (1D data).
- class CommensurableValues(data, scale=None, stype=None)
Bases:
Values[S],Generic[S]This class describes values with a single scale.
Instances are also immutable mapping of labels and
Valueobjects and can be accessed, iterated over, as such.- Parameters
data (Series) –
scale (S | None) –
stype (Union[Type[S], None]) – scales type used
- Raises
KeyError – if some labels are duplicated
TypeError – if stype and scale type mismatch
- Attr data
internal representation of data
- property bounds: S
Infer one common scale from the data.
It uses
stypeand call itsmcda.core.scales.Scale.fit()method.- Returns
inferred scale
- copy()
Return a copy of the object.
- Return type
Self
- dominate(other)
Check whether the ranking dominates an other one.
- Parameters
other (Values) –
- Returns
Trueif this object dominatesother,Falseotherwise- Raises
TypeError – if values are not ordinal
- Return type
bool
Note
this is done according to this object
scales
- dominate_strongly(other)
Check whether the ranking dominates strongly an other one.
- Parameters
other (Values) –
- Returns
Trueif this object dominates stronglyother,Falseotherwise- Raises
TypeError – if values are not ordinal
- Return type
bool
Note
this is done according to this object
scales
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- property is_numeric: bool
Check whether values are numeric.
- Returns
- Return type
bool
- property is_ordinal: bool
Check whether scales are all ordinal.
- Returns
- property is_within_scales: bool
Check whether all values are within their respective scales.
- Returns
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- property labels: List
Return the data labels.
- property name: Any
Return the name of the
dataattribute.
- sort(ascending=False)
Return sorted data in new instance.
Numeric values are used to determine the sorting order.
- Parameters
ascending (bool) – if
True, will sort in ascending order- Returns
- Raises
TypeError – if values are not ordinal
- Return type
Self
Note
in case of equal values, original order is conserved
Warning
scalesare not taken into accountChanged in version 1.1.0: original order between equal values is conserved (less surprising)
- sum()
Return the sum of the data.
- Returns
- Return type
float
Warning
it will raise a
TypeErrorif data contains numeric and non-numeric values
- property to_numeric: CommensurableValues[QuantitativeScale]
Return numeric conversion of ordinal values.
- Raises
TypeError – if
scalesare not ordinal
- values() an object providing a view on D's values
- property within_scales: Series
Return a series indicating which values are within their respective scale.
- Returns
- class Value(value, scale)
Bases:
Generic[S]This class define a single value along its scale.
Those instances are comparable with each other, as long as they share a common
scale, and can be compared to raw values. In the latter case, thescaleis assumed as beign the scale of the raw value.- Parameters
value (Any) –
scale (S) –
Note
This class is not intended for general use, it is only intended for the inspection of
Valuescells.
- class Values(data, scales=None, stype=None)
Bases:
IVector,Mapping[Any,Value[S]],Generic[S]This class associates a data
pandas.Serieswith their multiplemcda.core.Scale.Instances are also immutable mapping of labels and
Valueobjects and can be accessed, iterated over, as such.- Parameters
data (Series) – series containing the data
scales (Union[S, Mapping[Any, S], None]) – data scale(s) (one per value or one shared, will be inferred from data if absent using
Scale.fit())stype (Union[Type[S], None]) – scales type used
- Raises
KeyError – if some labels are duplicated
TypeError – if stype and scales types mismatch
- Attr data
internal representation of data
- property bounds: S
Infer one common scale from the data.
It uses
stypeand call itsmcda.core.scales.Scale.fit()method.- Returns
inferred scale
- copy()
Return a copy of the object.
- Return type
Self
- dominate(other)
Check whether the ranking dominates an other one.
- Parameters
other (Values) –
- Returns
Trueif this object dominatesother,Falseotherwise- Raises
TypeError – if values are not ordinal
- Return type
bool
Note
this is done according to this object
scales
- dominate_strongly(other)
Check whether the ranking dominates strongly an other one.
- Parameters
other (Values) –
- Returns
Trueif this object dominates stronglyother,Falseotherwise- Raises
TypeError – if values are not ordinal
- Return type
bool
Note
this is done according to this object
scales
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- property is_numeric: bool
Check whether values are numeric.
- Returns
- Return type
bool
- property is_ordinal: bool
Check whether scales are all ordinal.
- Returns
- property is_within_scales: bool
Check whether all values are within their respective scales.
- Returns
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- property labels: List
Return the data labels.
- property name: Any
Return the name of the
dataattribute.
- sort(ascending=False)
Return sorted data in new instance.
Numeric values are used to determine the sorting order.
- Parameters
ascending (bool) – if
True, will sort in ascending order- Returns
- Raises
TypeError – if values are not ordinal
- Return type
Self
Warning
scalesare not taken into account
- sum()
Return the sum of the data.
- Returns
- Return type
float
Warning
it will raise a
TypeErrorif data contains numeric and non-numeric values
- property to_numeric: Values[QuantitativeScale]
Return numeric conversion of ordinal values.
- Raises
TypeError – if
scalesare not ordinal
- values() an object providing a view on D's values
- property within_scales: Series
Return a series indicating which values are within their respective scale.
- Returns
- series_equals(s1, s2)
Check if two series have the same values.
It will realign the indexes if they are ordered differently.
- Parameters
s1 (Series) –
s2 (Series) –
- Returns
- Return type
bool