Detail: Bus: Constructor#
- Bus.__init__(frames, /, *, index, index_constructor=None, name=<object object>, store=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
Businto a newBus. AllBuswill load allFrameinto 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_frames(frames, /, *, index_constructor=None, name=None)[source]#
Return a
Busfrom 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_items(pairs, /, *, name=None, index_constructor=None)[source]#
Return a
Busfrom 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_manifest(label_to_fp_or_fps, /, *, max_persist=None, index_constructor=None)[source]#
Load a Bus from arbitrary collections of `Frame`s stored on the file system as one of NPZ, pickle, or NPY directory. Initialization is possible from a mapping of label, file paths, or an iterable of file paths (where file names become labels).
- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat a time without ever holding in memory more than 1Frame.
>>> 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') >>> f1.to_pickle('/tmp/f1.pickle') >>> f2.to_npz('/tmp/f2.npz') >>> b1 = sf.Bus.from_manifest(("/tmp/f1.pickle", "/tmp/f2.npz")).rename("b1") >>> b1.inventory <Frame> <Index> path last_modified size <<U13> <Index> ('b1', 'f1') /tmp/f1.pickle 2026-03-18T00:43:09… 861 B ('b1', 'f2') /tmp/f2.npz 2026-03-18T00:43:09… 844 B <object> <<U14> <<U32> <<U5> >>> b2 = sf.Bus.from_manifest({"x": "/tmp/f1.pickle", "y": "/tmp/f2.npz"}).rename("b2") >>> b2.inventory <Frame> <Index> path last_modified size <<U13> <Index> ('b2', 'x') /tmp/f1.pickle 2026-03-18T00:43:09… 861 B ('b2', 'y') /tmp/f2.npz 2026-03-18T00:43:09… 844 B <object> <<U14> <<U32> <<U5>
- classmethod Bus.from_series(series, /, *, store=None, max_persist=None, own_data=False)[source]#
Create a
Busfrom aSeriesofFrame.>>> 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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
Busstore, return aBusinstance.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigmax_persist – When loading
Framefrom aStore, optionally define the maximum number ofFrameto remain in theBus, regardless of the size of theBus. If more thanmax_persistnumber ofFrameare loaded, least-recently loadedFramewill be replaced byFrameDeferred. Amax_persistof 1, for example, permits reading oneFrameat 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 | Accessor Mapping