-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: True cannot be cast to bool in read_excel #58994
base: main
Are you sure you want to change the base?
Changes from 2 commits
1fcbde6
f77c41d
ffb65d4
14e565e
873bc9b
e918066
7de150e
e9fe60c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,17 @@ def xfail_datetimes_with_pyxlsb(engine, request): | |
|
||
|
||
class TestReaders: | ||
def test_read_excel_type_check(self): | ||
# GH 58159 | ||
df = DataFrame({"bool_column": [True]}, dtype=pd.BooleanDtype.name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since |
||
df.to_excel("test-type.xlsx", index=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you use the |
||
df2 = pd.read_excel( | ||
"test-type.xlsx", | ||
dtype={"bool_column": pd.BooleanDtype.name}, | ||
engine="openpyxl", | ||
) | ||
assert all(isinstance(val, bool) for val in df2["bool_column"]) | ||
|
||
@pytest.fixture(autouse=True) | ||
def cd_and_set_engine(self, engine, datapath, monkeypatch): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.