Detail: Bus: Constructor
- Bus.__init__(frames, *, index, index_constructor=None, name=<object object>, store=None, config=None, max_persist=None, own_index=False, own_data=False)[source]
Default Bus constructor.
{args}
>>> sf.Bus((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), index=('a', 'b')) <Bus> <Index> a Frame b Frame <<U1> <object>
- classmethod Bus.from_concat(containers, *, index=None, name=<object object>)[source]
Concatenate multiple
Bus
into a newBus
. AllBus
will load allFrame
into memory if any are deferred.>>> b1 = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b1 <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b2 = sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j') >>> b2 <Bus: j> <Index> v Frame w Frame <<U1> <object> >>> sf.Bus.from_concat((b1, b2)) <Bus> <Index> x Frame y Frame v Frame w Frame <<U1> <object>
- classmethod Bus.from_dict(mapping, *, name=None, index_constructor=None)[source]
Bus construction from a mapping of labels and
Frame
.- Parameters:
mapping – a dictionary or similar mapping interface.
- Returns:
>>> sf.Bus.from_dict(dict(j=sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), k=sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y'))) <Bus> <Index> j Frame k Frame <<U1> <object>
- classmethod Bus.from_duckdb(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to an DuckDB
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y'), sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='k') >>> b <Bus: k> <Index> x Frame y Frame v Frame w Frame <<U1> <object> >>> b.to_duckdb('/tmp/b.duckdb') >>> sf.Bus.from_duckdb('/tmp/b.duckdb') <Bus> <Index> v <FrameDeferred> w <FrameDeferred> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_frames(frames, *, index_constructor=None, config=None, name=None)[source]
Return a
Bus
from an iterable ofFrame
; labels will be drawn fromFrame.name
.>>> sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') <Bus: i> <Index> x Frame y Frame <<U1> <object>
- classmethod Bus.from_hdf5(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to a HDF5
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_hdf5('/tmp/b.hdf5') >>> sf.Bus.from_hdf5('/tmp/b.hdf5') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_items(pairs, *, config=None, name=None, index_constructor=None)[source]
Return a
Bus
from an iterable of pairs of label,Frame
.- Returns:
>>> sf.Bus.from_items((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')))) <Bus> <Index> i Frame j Frame <<U1> <object>
- classmethod Bus.from_series(series, *, store=None, config=None, max_persist=None, own_data=False)[source]
Create a
Bus
from aSeries
ofFrame
.>>> f1 = sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x') >>> f2 = sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y') >>> s = sf.Series((f1, f2), index=(f1.name, f2.name)) >>> sf.Bus.from_series(s) <Bus> <Index> x Frame y Frame <<U1> <object>
- classmethod Bus.from_sqlite(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to an SQLite
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_sqlite('/tmp/b.sqlite') >>> sf.Bus.from_sqlite('/tmp/b.sqlite') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_xlsx(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to an XLSX
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_xlsx('/tmp/b.xlsx') >>> sf.Bus.from_xlsx('/tmp/b.xlsx') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_zip_csv(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to zipped CSV
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_zip_csv('/tmp/b.zip') >>> sf.Bus.from_zip_csv('/tmp/b.zip') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_zip_npy(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to zipped NPY
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_zip_npy('/tmp/b.zip') >>> sf.Bus.from_zip_npy('/tmp/b.zip') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_zip_npz(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to zipped NPZ
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_zip_npz('/tmp/b.zip') >>> sf.Bus.from_zip_npz('/tmp/b.zip') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_zip_parquet(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to zipped parquet
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_zip_parquet('/tmp/b.zip') >>> sf.Bus.from_zip_parquet('/tmp/b.zip') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_zip_pickle(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to zipped pickle
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_zip_pickle('/tmp/b.zip') >>> sf.Bus.from_zip_pickle('/tmp/b.zip') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
- classmethod Bus.from_zip_tsv(fp, *, config=None, max_persist=None, index_constructor=None)[source]
Given a file path to zipped TSV
Bus
store, return aBus
instance.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
max_persist – When loading
Frame
from aStore
, optionally define the maximum number ofFrame
to remain in theBus
, regardless of the size of theBus
. If more thanmax_persist
number ofFrame
are loaded, least-recently loadedFrame
will be replaced byFrameDeferred
. Amax_persist
of 1, for example, permits reading oneFrame
at a time without ever holding in memory more than 1Frame
.
>>> b = sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i') >>> b <Bus: i> <Index> x Frame y Frame <<U1> <object> >>> b.to_zip_tsv('/tmp/b.zip') >>> sf.Bus.from_zip_tsv('/tmp/b.zip') <Bus> <Index> x <FrameDeferred> y <FrameDeferred> <<U1> <object>
Bus: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic