API Reference
Table of Contents
si_unit_pandas.base
Base functionality.
Classes:
Mixin for pandas extension backed by a numpy array. |
-
class
NumPyBackedExtensionArrayMixin[source] Bases:
ExtensionArrayMixin for pandas extension backed by a numpy array.
Methods:
__len__()Returns the length of this array.
argsort([ascending, kind])Return the indices that would sort this array.
copy([deep])Return a copy of the array.
setitem(indexer, value)Set the 'value' inplace.
tolist()Convert the array to a Python list.
unique()Compute the ExtensionArray of unique values.
Attributes:
The dtype for this extension array,
CelsiusType.The number of bytes needed to store this object in memory.
Return a tuple of the array dimensions.
-
argsort(ascending=True, kind='quicksort', *args, **kwargs)[source] Return the indices that would sort this array.
- Parameters
*args and **kwargs are passed through to
numpy.argsort().- Return type
- Returns
Array of indices that sort
self. If NaN values are contained, NaN values are placed at the end.
See also
numpy.argsort: Sorting implementation used internally.
-
property
dtype The dtype for this extension array,
CelsiusType.- Return type
Type[ExtensionDtype]
-
si_unit_pandas.temperature
Temperature-specific functionality.
Classes:
|
|
Numpy dtype representing a temperature in degrees Celsius. |
|
|
|
|
Holder for Temperatures. |
Metaclass providing a common base class for Temperatures. |
Functions:
|
Returns whether |
|
Convert values to a |
-
class
Celsius(value)[source] Bases:
UserFloatfloatsubclass representing a temperature in Celsius.Convert a string or number to a floating point number, if possible.
Methods:
__repr__()Return a string representation of the temperature.
__str__()Return the temperature as a string.
-
class
CelsiusType[source] Bases:
ExtensionDtypeNumpy dtype representing a temperature in degrees Celsius.
Methods:
Return the array type associated with this dtype.
construct_from_string(string)Construct a
CelsiusTypefrom a string.Classes:
alias of
TemperatureBase-
classmethod
construct_array_type()[source] Return the array type associated with this dtype.
Returns
type
- rtype
-
classmethod
construct_from_string(string)[source] Construct a
CelsiusTypefrom a string.- Parameters
string (
str)- Return type
-
type alias of
TemperatureBase
-
classmethod
-
class
Fahrenheit(value=0.0)[source] Bases:
UserFloatfloatsubclass representing a temperature in Fahrenheit.Convert a string or number to a floating point number, if possible.
Methods:
__repr__()Return a string representation of the temperature.
__str__()Return the temperature as a string.
-
class
TemperatureArray(data, dtype=None, copy=False)[source] Bases:
BaseArrayHolder for Temperatures.
TemperatureArray is a container for Temperatures. It satisfies pandas’ extension array interface, and so can be stored inside
pandas.Seriesandpandas.DataFrame.Methods:
__getitem__(item)Select a subset of self.
append(value)Append a value to this TemperatureArray.
astype(dtype[, copy])Returns the array with its values as the given dtype.
isin(other)Check whether elements of self are in other.
-
__getitem__(item)[source] Select a subset of self.
- Parameters
item (
Union[int,slice,ndarray]) –int: The position in ‘self’ to get.
slice: A slice object, where ‘start’, ‘stop’, and ‘step’ are integers or None.
ndarray: A 1-d boolean NumPy ndarray the same length as ‘self’
- Return type
scalar or ExtensionArray
Note
For scalar
item, return a scalar value suitable for the array’s type. This should be an instance ofself.dtype.type.For slice
key, return an instance ofExtensionArray, even if the slice is length 0 or 1.For a boolean mask, return an instance of
ExtensionArray, filtered to the values whereitemis True.
-
-
class
TemperatureBase[source] Bases:
objectMetaclass providing a common base class for Temperatures.