From 1e9cbaa8a3ba517b195cce9c35bfa6ca65a1f673 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Mon, 20 Jun 2022 21:54:36 -0700 Subject: [PATCH 1/4] Fix pd.read_excel --- pandas-stubs/io/excel/__init__.pyi | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 pandas-stubs/io/excel/__init__.pyi diff --git a/pandas-stubs/io/excel/__init__.pyi b/pandas-stubs/io/excel/__init__.pyi new file mode 100644 index 000000000..3156999fe --- /dev/null +++ b/pandas-stubs/io/excel/__init__.pyi @@ -0,0 +1,5 @@ +from pandas.io.excel._base import ( + ExcelFile as ExcelFile, + ExcelWriter as ExcelWriter, + read_excel as read_excel, +) From 3aa56175c66f6edb50ad788b583c325967606fe6 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Fri, 1 Jul 2022 10:55:26 +0530 Subject: [PATCH 2/4] add a test --- tests/test_frame.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_frame.py b/tests/test_frame.py index 38bc735ca..e71ae5ebe 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -3,7 +3,7 @@ import io import tempfile from pathlib import Path -from typing import List, Tuple, Iterable, Any, Dict, Hashable +from typing import List, Tuple, Iterable, Any, Dict, Hashable, Union from typing_extensions import assert_type import pandas as pd @@ -997,3 +997,9 @@ def test_getmultiindex_columns() -> None: def test_frame_getitem_isin() -> None: df = pd.DataFrame({"x": [1, 2, 3, 4, 5]}, index=[1, 2, 3, 4, 5]) assert_type(df[df.index.isin([1, 3, 5])], "pd.DataFrame") + + +def test_read_excel() -> None: + df11: pd.DataFrame = pd.read_excel("foo") + df12: pd.DataFrame = pd.read_excel("foo", sheet_name="sheet") + df13: Dict[Union[int, str], pd.DataFrame] = pd.read_excel("foo", sheet_name=["sheet"]) From d8dc6f447d74a19c44f0ea37adcd7c73e95771da Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sat, 2 Jul 2022 00:06:50 +0530 Subject: [PATCH 3/4] fix merge, cr feedback --- tests/test_frame.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/test_frame.py b/tests/test_frame.py index e7260fdbe..562520554 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -1,13 +1,8 @@ # flake8: noqa: F841 -from datetime import ( - date, - datetime, -) +from datetime import date import io from pathlib import Path -<<<<<<< HEAD -from typing import List, Tuple, Iterable, Any, Dict, Hashable, Union -======= +from typing import List, Tuple, Iterable, Any, Dict, Union import tempfile from typing import ( Any, @@ -21,7 +16,6 @@ import pandas as pd from pandas._testing import getSeriesData import pytest ->>>>>>> upstream/main from typing_extensions import assert_type from pandas.io.parsers import TextFileReader @@ -1017,6 +1011,9 @@ def test_frame_getitem_isin() -> None: def test_read_excel() -> None: + pytest.skip() + + # https://github.com/pandas-dev/pandas-stubs/pull/33 df11: pd.DataFrame = pd.read_excel("foo") df12: pd.DataFrame = pd.read_excel("foo", sheet_name="sheet") df13: Dict[Union[int, str], pd.DataFrame] = pd.read_excel("foo", sheet_name=["sheet"]) From f47c8e1603fad45c380825b0e0fa1bad30da54ef Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sat, 2 Jul 2022 00:07:35 +0530 Subject: [PATCH 4/4] actually fix merge --- tests/test_frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_frame.py b/tests/test_frame.py index 562520554..73dd48199 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -2,10 +2,10 @@ from datetime import date import io from pathlib import Path -from typing import List, Tuple, Iterable, Any, Dict, Union import tempfile from typing import ( Any, + Dict, Iterable, List, Tuple,