colstore.from_root¶
- colstore.from_root(source, path, *, backend='auto', treename=None, columns=None, keep_valid_only=True, batch_size='512 MiB', compact=True, mode='create', show_progress=True)[source]¶
Convert a ROOT source into a
.cstorefile and open it for reading.- Parameters:
source (ROOT.RDataFrame, str, os.PathLike, list, or dict) – An existing
RDataFrame(read only by the"ROOT"backend); a path to a.rootfile (its single tree is used, ortreenameselects one); a list of paths read as one combined dataset over a shared tree (fromtreename, an embedded"file.root:treename", or the first file’s sole tree); or a{treename: files}mapping with exactly one entry (filesmay be a path or a list). Astrpath may embed the tree as"file.root:treename"(the uproot convention; URL-scheme and Windows-drive colons are not separators). To read a file whose name contains a colon, pass it as apathlib.Path(never split) or use the mapping form.path (str or os.PathLike) – Destination
.cstorefile.backend (str, optional) – Backend to read with:
"auto"(default) uses PyROOT if importable, else uproot;"ROOT"forces PyROOT/RDataFrame;"uproot"forces uproot. Raises if the requested backend is missing.treename (str or None, optional) – Tree to read when
sourceis a bare.rootpath.Noneauto-detects the file’s sole tree and errors if there are several. It is an error to pass atreenamethat disagrees with an embedded"file.root:treename".columns (list[str] or None, optional) – Columns to store, in this order.
None(default) considers every column in the tree.keep_valid_only (bool, optional) –
True(default) keeps the fixed-size scalar columns and skips any non-storable (jagged / array / pointer) column with a warning, whether it was auto-discovered or named incolumns.Falseraises if any column in scope is not storable.batch_size (int, str, or None, optional) – Memory budget per batch.
Nonereads everything in one pass; anintis rows per batch; astr(default"512 MiB") is a byte budget converted to rows. Each batch becomes one record.compact (bool, optional) – Collapse the records into one afterward for the single-record fast read path. Defaults to True.
mode (str, optional) –
"create"(default),"recreate", or"update".show_progress (bool, optional) – Whether to display a progress bar. Defaults to True.
- Returns:
colstore.ColStoreReader – An opened reader over the written file.
- Return type: