Detail: Batch: Exporter

Overview: Batch: Exporter

Batch.to_bus(*, index_constructor=None)[source]

Realize the Batch as an Bus. Note that, as a Bus must have all labels (even if Frame are loaded lazily), this Batch will be exhausted.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_bus()
<Bus>
<Index>
i       Frame
j       Frame
<<U1>   <object>
Batch.to_frame(*, axis=0, union=True, index=None, columns=None, index_constructor=None, columns_constructor=None, name=None, fill_value=nan, consolidate_blocks=False)[source]

Consolidate stored Frame into a new Frame using the stored labels as the index on the provided axis using Frame.from_concat. This assumes that that the contained Frame have been reduced to a single dimension along the provided axis.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       1
i                q     2       3
i                r     4       5
j                p     40      41
j                q     42      43
j                r     44      45
<<U1>            <<U1> <int64> <int64>
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_hdf5('/tmp/f.h5')
Batch.to_series(*, dtype=None, name=None, index_constructor=None)[source]

Consolidate stored values into a new Series using the stored labels as the index.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_series()
<Series>
<Index>
i        Frame
j        Frame
<<U1>    <object>
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_sqlite('/tmp/f.sqlite')
Batch.to_visidata()

Open an interactive VisiData session.

Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_xlsx('/tmp/f.xlsx')
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_zip_csv('/tmp/f.zip')
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_zip_npy('/tmp/f.zip')
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_zip_npz('/tmp/f.zip')
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_zip_parquet('/tmp/f.zip')
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_zip_pickle('/tmp/f.zip')
Batch.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 ot StoreConfig

  • 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.

>>> bt1 = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt1.to_zip_tsv('/tmp/f.zip')

Batch: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic