Skip to content

Commit 8deb2ef

Browse files
CLN: Raise note reading exceptions for unsupported engines (pandas-dev#58070)
Co-authored-by: Dacops <[email protected]>
1 parent aba54de commit 8deb2ef

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

pandas/io/excel/_calamine.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,19 @@ def get_sheet_by_index(self, index: int) -> CalamineSheet:
9898
return self.book.get_sheet_by_index(index)
9999

100100
def get_sheet_data(
101-
self, sheet: CalamineSheet, file_rows_needed: int | None = None
101+
self,
102+
sheet: CalamineSheet,
103+
file_rows_needed: int | None = None,
104+
notes: pd.DataFrame | None = None,
102105
) -> list[list[Scalar | NaTType | time]]:
106+
if notes is not None:
107+
raise NotImplementedError(
108+
"""
109+
Notes are not supported in python-calamine engine,
110+
see https://github.com/dimastbk/python-calamine/tree/master
111+
"""
112+
)
113+
103114
def _convert_cell(value: _CellValue) -> Scalar | NaTType | time:
104115
if isinstance(value, float):
105116
val = int(value)

pandas/io/excel/_odfreader.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def get_sheet_by_name(self, name: str):
100100
raise ValueError(f"sheet {name} not found")
101101

102102
def get_sheet_data(
103-
self, sheet, file_rows_needed: int | None = None
103+
self,
104+
sheet,
105+
file_rows_needed: int | None = None,
106+
notes: pd.DataFrame | None = None,
104107
) -> list[list[Scalar | NaTType]]:
105108
"""
106109
Parse an ODF Table into a list of lists
@@ -111,6 +114,14 @@ def get_sheet_data(
111114
TableRow,
112115
)
113116

117+
if notes is not None:
118+
raise NotImplementedError(
119+
"""
120+
Notes are not supported in odfreader engine,
121+
see https://github.com/eea/odfpy
122+
"""
123+
)
124+
114125
covered_cell_name = CoveredTableCell().qname
115126
table_cell_name = TableCell().qname
116127
cell_names = {covered_cell_name, table_cell_name}

pandas/io/excel/_pyxlsb.py

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
StorageOptions,
2121
)
2222

23+
from pandas.core.frame import DataFrame
24+
2325

2426
class PyxlsbReader(BaseExcelReader["Workbook"]):
2527
@doc(storage_options=_shared_docs["storage_options"])
@@ -98,7 +100,16 @@ def get_sheet_data(
98100
self,
99101
sheet,
100102
file_rows_needed: int | None = None,
103+
notes: DataFrame | None = None,
101104
) -> list[list[Scalar]]:
105+
if notes is not None:
106+
raise NotImplementedError(
107+
"""
108+
Notes are not supported in pyxlsb engine,
109+
see https://github.com/willtrnr/pyxlsb
110+
"""
111+
)
112+
102113
data: list[list[Scalar]] = []
103114
previous_row_number = -1
104115
# When sparse=True the rows can have different lengths and empty rows are

0 commit comments

Comments
 (0)