Detail: Yarn: Exporter
- Yarn.to_duckdb(fp, *, config=None)
Write the complete
Bus
as an SQLite database file.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False) >>> y <Yarn> <Index> x Frame y Frame v Frame w Frame <<U1> <object> >>> y.to_duckdb('/tmp/y.duckdb')
- Yarn.to_hdf5(fp, *, config=None)
Write the complete
Bus
as an HDF5 table.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False) >>> y <Yarn> <Index> x Frame y Frame v Frame w Frame <<U1> <object> >>> y.to_hdf5('/tmp/y.hdf5')
- Yarn.to_series()[source]
Return a
Series
with theFrame
contained in all containedBus
.>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False) >>> y <Yarn> <Index> x Frame y Frame v Frame w Frame <<U1> <object> >>> y.to_series() <Series> <Index> x Frame y Frame v Frame w Frame <<U1> <object>
- Yarn.to_sqlite(fp, *, config=None)
Write the complete
Bus
as an SQLite database file.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False) >>> y <Yarn> <Index> x Frame y Frame v Frame w Frame <<U1> <object> >>> y.to_sqlite('/tmp/y.sqlite')
- Yarn.to_visidata()
Open an interactive VisiData session.
- Yarn.to_xlsx(fp, *, config=None)
Write the complete
Bus
as a XLSX workbook.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False) >>> y <Yarn> <Index> x Frame y Frame v Frame w Frame <<U1> <object> >>> y.to_xlsx('/tmp/y.xlsx')
- Yarn.to_zip_csv(fp, *, config=None, compression=8)
Write the complete
Bus
as a zipped archive of CSV files.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.to_zip_csv('/tmp/y.zip', config=sf.StoreConfig(label_encoder=str))
- Yarn.to_zip_npy(fp, *, config=None, compression=8)
Write the complete
Bus
as a zipped archive of NPY files.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.to_zip_npy('/tmp/y.zip', config=sf.StoreConfig(label_encoder=str))
- Yarn.to_zip_npz(fp, *, config=None, compression=8)
Write the complete
Bus
as a zipped archive of NPZ files.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.to_zip_npz('/tmp/y.zip', config=sf.StoreConfig(label_encoder=str))
- Yarn.to_zip_parquet(fp, *, config=None, compression=8)
Write the complete
Bus
as a zipped archive of parquet files.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.to_zip_parquet('/tmp/y.zip', config=sf.StoreConfig(label_encoder=str))
- Yarn.to_zip_pickle(fp, *, config=None, compression=8)
Write the complete
Bus
as a zipped archive of pickles.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.to_zip_pickle('/tmp/y.zip', config=sf.StoreConfig(label_encoder=str))
- Yarn.to_zip_tsv(fp, *, config=None, compression=8)
Write the complete
Bus
as a zipped archive of TSV files.- Parameters:
fp – A string file path or
Path
instance.config – A
StoreConfig
, or a mapping of label otStoreConfig
compression – Provide a zip compression setting using values from the Python
zipfile
module;zipfile.ZIP_DEFLATED
is standard zlib compression;zipfile.ZIP_STORED
disables compression and may give better performance at the cost of larger file sizes.
>>> 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') >>> 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') >>> y = sf.Yarn.from_buses((b1, b2), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.to_zip_tsv('/tmp/y.zip', config=sf.StoreConfig(label_encoder=str))
Yarn: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic