Detail: Bus: Exporter#
- Bus.to_manifest(fp, /, *, label_encoder=None)[source]#
Write each contained
Frameas an NPY directory within the directory given byfp. EachFrameis stored as a subdirectory named by its label. When theBusis backed by a zip NPY or zip NPZ store, arrays are extracted directly without fullFramematerialization.- Parameters:
fp – directory path in which to write the manifest.
label_encoder – callable to convert non-string labels to strings for use as directory names. Required when labels are not strings.
>>> 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_manifest('/tmp/b_manifest') >>> sorted(e.name for e in os.scandir('/tmp/b_manifest')) ['x', 'y']
- Bus.to_series()[source]#
Return a
Serieswith theFramecontained in thisBus. If theBusis associated with aStore, allFramewill be loaded into memory and the returnedBuswill no longer be associated with theStore.>>> 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_series() <Series: i> <Index> x Frame y Frame <<U1> <object>
- Bus.to_sqlite(fp, /, *, config=None)#
Write the complete
Busas an SQLite database file.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_visidata()#
Open an interactive VisiData session.
- Bus.to_xlsx(fp, /, *, config=None)#
Write the complete
Busas a XLSX workbook.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_zip_csv(fp, /, *, config=None, compression=8)#
Write the complete
Busas a zipped archive of CSV files.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_zip_npy(fp, /, *, config=None, compression=8)#
Write the complete
Busas a zipped archive of NPY files.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_zip_npz(fp, /, *, config=None, compression=8)#
Write the complete
Busas a zipped archive of NPZ files.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_zip_parquet(fp, /, *, config=None, compression=8)#
Write the complete
Busas a zipped archive of parquet files.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_zip_pickle(fp, /, *, config=None, compression=8)#
Write the complete
Busas a zipped archive of pickles.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
- Bus.to_zip_tsv(fp, /, *, config=None, compression=8)#
Write the complete
Busas a zipped archive of TSV files.- Parameters:
fp – A string file path or
Pathinstance.config – A
StoreConfig, or a mapping of label toStoreConfigcompression – Provide a zip compression setting using values from the Python
zipfilemodule;zipfile.ZIP_DEFLATEDis standard zlib compression;zipfile.ZIP_STOREDdisables compression and may give better performance at the cost of larger file sizes.
>>> 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')
Bus: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic | Accessor Mapping