Skip to content

Commit 79fea46

Browse files
committed
GH1061 add calamine literal to ExcelFile engine
1 parent b6ae6e8 commit 79fea46

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pandas-stubs/io/excel/_base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class ExcelFile:
246246
def __init__(
247247
self,
248248
io: FilePath | ReadBuffer[bytes] | bytes,
249-
engine: Literal["xlrd", "openpyxl", "odf", "pyxlsb"] | None = ...,
249+
engine: ExcelReadEngine | None = ...,
250250
storage_options: StorageOptions = ...,
251251
) -> None: ...
252252
def __fspath__(self): ...

tests/test_io.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,13 @@ def test_read_excel_dtypes():
11081108
dtypes = {"a": np.int64, "b": str, "c": np.float64}
11091109
check(assert_type(read_excel(path, dtype=dtypes), pd.DataFrame), pd.DataFrame)
11101110

1111+
def test_excel_reader():
1112+
with ensure_clean(".xlsx") as path:
1113+
check(assert_type(DF.to_excel(path), None), type(None))
1114+
with pd.ExcelFile(path, engine="calamine") as ef:
1115+
check(assert_type(ef, pd.ExcelFile), pd.ExcelFile)
1116+
check(assert_type(pd.read_excel(ef), pd.DataFrame), pd.DataFrame)
1117+
11111118

11121119
def test_excel_writer():
11131120
with ensure_clean(".xlsx") as path:

0 commit comments

Comments
 (0)