Skip to content

Commit 2d6828d

Browse files
authored
docs: update documentation (#383)
* update documentation * shorten line length * satisfy ruff lint * Don't rely on `pandas` extra to pull the `pyarrow` library
1 parent f7616b5 commit 2d6828d

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

python/fastexcel/__init__.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def visible(self) -> SheetVisible:
101101
return self._sheet.visible
102102

103103
def to_arrow(self) -> "pa.RecordBatch":
104-
"""Converts the sheet to a pyarrow `RecordBatch`"""
104+
"""Converts the sheet to a pyarrow `RecordBatch`
105+
106+
Requires the `pyarrow` extra to be installed.
107+
"""
105108
if not _PYARROW_AVAILABLE:
106109
raise ImportError(
107110
"pyarrow is required for to_arrow(). Install with: pip install 'fastexcel[pyarrow]'"
@@ -113,6 +116,8 @@ def to_arrow_with_errors(self) -> "tuple[pa.RecordBatch, CellErrors | None]":
113116
114117
Stores the positions of any values that cannot be parsed as the specified type and were
115118
therefore converted to None.
119+
120+
Requires the `pyarrow` extra to be installed.
116121
"""
117122
if not _PYARROW_AVAILABLE:
118123
raise ImportError(
@@ -220,7 +225,10 @@ def specified_dtypes(self) -> DTypeMap | None:
220225
return self._table.specified_dtypes
221226

222227
def to_arrow(self) -> "pa.RecordBatch":
223-
"""Converts the table to a pyarrow `RecordBatch`"""
228+
"""Converts the table to a pyarrow `RecordBatch`
229+
230+
Requires the `pyarrow` extra to be installed.
231+
"""
224232
if not _PYARROW_AVAILABLE:
225233
raise ImportError(
226234
"pyarrow is required for to_arrow(). Install with: pip install 'fastexcel[pyarrow]'"
@@ -463,6 +471,11 @@ def load_table(
463471
indicating whether the column should be used
464472
:param dtypes: An optional dtype (for all columns)
465473
or dict of dtypes with keys as column indices or names.
474+
:param eager: Specifies whether the table should be loaded eagerly.
475+
`False` (default) will load the table lazily using the `PyCapsule` interface,
476+
whereas `True` will load it eagerly via `pyarrow`.
477+
478+
Eager loading requires the `pyarrow` extra to be installed.
466479
"""
467480
if eager:
468481
return self._reader.load_table(
@@ -512,6 +525,8 @@ def load_sheet_eager(
512525
`worksheet_range_ref` under the hood, which returns borrowed types.
513526
514527
Refer to `load_sheet` for parameter documentation
528+
529+
Requires the `pyarrow` extra to be installed.
515530
"""
516531
return self._reader.load_sheet(
517532
idx_or_name=idx_or_name,
@@ -618,6 +633,8 @@ def read_excel(source: Path | str | bytes) -> ExcelReader:
618633
"ExcelReader",
619634
# Excel sheet
620635
"ExcelSheet",
636+
# Excel table
637+
"ExcelTable",
621638
# Column metadata
622639
"DTypeFrom",
623640
"ColumnNameFrom",

python/fastexcel/_fastexcel.pyi

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,17 @@ class _ExcelSheet:
8484
def visible(self) -> SheetVisible:
8585
"""The visibility of the sheet"""
8686
def to_arrow(self) -> "pa.RecordBatch":
87-
"""Converts the sheet to a pyarrow `RecordBatch`"""
87+
"""Converts the sheet to a pyarrow `RecordBatch`
88+
89+
Requires the `pyarrow` extra to be installed.
90+
"""
8891
def to_arrow_with_errors(self) -> "tuple[pa.RecordBatch, CellErrors]":
8992
"""Converts the sheet to a pyarrow `RecordBatch` with error information.
9093
9194
Stores the positions of any values that cannot be parsed as the specified type and were
9295
therefore converted to None.
96+
97+
Requires the `pyarrow` extra to be installed.
9398
"""
9499
def __arrow_c_schema__(self) -> object:
95100
"""Export the schema as an `ArrowSchema` `PyCapsule`.
@@ -138,7 +143,10 @@ class _ExcelTable:
138143
def specified_dtypes(self) -> DTypeMap | None:
139144
"""The dtypes specified for the table"""
140145
def to_arrow(self) -> "pa.RecordBatch":
141-
"""Converts the table to a pyarrow `RecordBatch`"""
146+
"""Converts the table to a pyarrow `RecordBatch`
147+
148+
Requires the `pyarrow` extra to be installed.
149+
"""
142150
def __arrow_c_schema__(self) -> object:
143151
"""Export the schema as an `ArrowSchema` `PyCapsule`.
144152

0 commit comments

Comments
 (0)