RedBlackPy 0.1.3

Table of contents:

Data types
Special methods


class redblackpy.Series( index=None, values=None, dtype="float32", name="Untitled",
                         interpolate="floor", extrapolate=0, arithmetic="union" )

Parameters and attributes

Initialization parameters:

Parameter Description
index iterable, container with keys
values iterable, container with values
dtype str, values type
name str, name
interpolate str, interpolation method
extrapolate dtype, extrapolation value


Attribute Description
interpolation str, interpolation method
extrapolation dtype, extrapolation value
arithmetic str, arithmetic type
name str, name
dtype str, data type


redblackpy.Series.insert(key, value) \(\rightarrow\) void

>>> import redblackpy as rb
>>> series = rb.Series()
>>> series.insert(1, 2)
>>> series.insert(1, 3)
>>> KeyError: 'Key already exists.'
>>> series.insert('2', 3)
>>> KeyError: 'Your query to tree contains inconsistent key type.'

redblackpy.Series.erase(key) \(\rightarrow\) void

redblackpy.Series.begin() \(\rightarrow\) object

redblackpy.Series.end() \(\rightarrow\) object

redblackpy.Series.index() \(\rightarrow\) list

redblackpy.Series.values() \(\rightarrow\) list

redblackpy.Series.iteritems() \(\rightarrow\) generator

redblackpy.Series.items() \(\rightarrow\) list

redblackpy.Series.floor(key) \(\rightarrow\) tuple

redblackpy.Series.ceil(key) \(\rightarrow\) tuple

redblackpy.Series.uniform(start, stop, step) \(\rightarrow\) Series

redblackpy.Series.truncate(start, stop) \(\rightarrow\) Series, inplace=False, args=(), kwargs={}) \(\rightarrow\) Series or void

redblackpy.Series.set_interpolation(str type) \(\rightarrow\) void

Type Description
"floor" returns value' that corresponding to key' such that key' is the greatest key less than or equal to key.
"ceil" returns value' that corresponding to key' such that key' is the least key greater than or equal to key.
"nn" returns value corresponding the nearest key.
"linear" linear interpolation between two keys.
"error" returns KeyError, getitem works only for keys in index.

Interpolation is built into the operator getitem. You can get values by any key using specific interpolation with no use of additional memory. Let's create Series object, by default it is created with "floor" interpolation type.

>>> import redblackpy as rb
>>> series = rb.Series(index=[0, 1, 2], values=[4, 6, 8])
>>> series[0]
>>> 4
>>> series[0.5]
>>> 4.0
>>> series.interpolation = "linear"
>>> series[0.5]
>>> 5.0

redblackpy.Series.set_extrapolation(dtype value) \(\rightarrow\) void

redblackpy.Series.set_arithmetic(str type) \(\rightarrow\) void

For details, see examples in User guide .

redblackpy.Series.on_itermode() \(\rightarrow\) void

redblackpy.Series.off_itermode() \(\rightarrow\) void

redblackpy.Series.cast_dtype(str dtype) \(\rightarrow\) void

Unsigned integers uint8, uint16, uint32,
uint64, uint96, uint128
Signed integers int8, int16, int32,
int64, int96, int128
Floating point types float32, float64, float80,
float96, float128
Python objects object, str

The bits number in some types is depend on your hardware and platform.

redblackpy.Series.to_pandas() \(\rightarrow\) pandas.Series

redblackpy.Series.from_pandas(pandas.Series) \(\rightarrow\) redblackpy.Series

Special methods

redblackpy.Series.__del__() \(\rightarrow\) void

redblackpy.Series.__len__() \(\rightarrow\) int

redblackpy.Series.__str__() \(\rightarrow\) str

redblackpy.Series.__repr__() \(\rightarrow\) str

redblackpy.Series.__contains__(key) \(\rightarrow\) bool

redblackpy.Series.__iter__() \(\rightarrow\) generator

redblackpy.Series.__getitem__(key) \(\rightarrow\) dtype or Series

redblackpy.Series.__setitem__(key, value) \(\rightarrow\) void

Emulating numeric types

redblackpy.Series.__add__(other) \(\rightarrow\) Series

redblackpy.Series.__sub__(other) \(\rightarrow\) Series

redblackpy.Series.__mul__(other) \(\rightarrow\) Series

redblackpy.Series.__div__(other) \(\rightarrow\) Series

redblackpy.Series.__truediv__(other) \(\rightarrow\) Series

redblackpy.Series.__lshift__(int shift) \(\rightarrow\) Series

redblackpy.Series.__rshift__(int shift) \(\rightarrow\) Series

Pickle serialization methods

redblackpy.Series.__getstate__() \(\rightarrow\) dict

redblackpy.Series.__setstate__(dict state) \(\rightarrow\) void

redblackpy.Series.__reduce__() \(\rightarrow\) tuple