Skip to content

excel.py

PandasExcel dataclass

Bases: IO[DataFrame]

IO to load from and save to Excel data using Pandas. Calls pd.read_excel and pd.to_excel under the hood.

Example usage:

>>> from pathlib import Path
>>> from ordeq_pandas import PandasExcel
>>> MyExcel = PandasExcel(
...     path=Path("path/to.xlsx")
... ).load(usecols="A:C")  # doctest: +SKIP

Load behaviour is configured by with_load_options:

>>> from pathlib import Path
>>> from ordeq_pandas import PandasExcel
>>> MyExcel = (
...     PandasExcel(
...         path=Path("path/to.xlsx")
...     )
...     .with_load_options(usecols="A:C")
... ).load()  # doctest: +SKIP