Skip to content

Conversions with .to()

Maturity labels

  • Now: Stable and supported in current releases.
  • Preview: Usable today, but behavior and APIs may evolve.
  • Planned: Not yet implemented.

Note

Status: Now

Convert dataset types

>>> import omnipy as om
>>> records = om.JsonListOfDictsDataset({'rows': [{'id': 'a', 'value': '1'}, {'id': 'b', 'value': 2}]})
>>> records.to(om.PandasDataset).json()

Convert model types

>>> import omnipy as om
>>> table = om.JsonListOfDictsModel([{'id': 'a', 'x': 1}, {'id': 'b', 'x': 3}])
>>> table.to(om.PandasModel)

Chaining conversions

Prefer explicit checkpoints:

  1. .json() to inspect shape
  2. .to(Target) to convert
  3. .json() again to confirm