-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
remove HashableT in frame.pyi where possible #1104
Conversation
@twoertwein I've addressed all your comments. I don't think any other changes are necessary. Let me know if you disagree. |
@twoertwein have updated with a test based on your finding. |
There are a few more of these cases - sorry, I was lazy and wrote quick tests for type checkers but they might fail at runtime. In all cases, the first one fails type checking whereas the second one passes: import pandas as pd
df = pd.DataFrame([])
test = ["test"]
df.to_stata("test", convert_strl=test)
df.to_stata("test", convert_strl=["test"])
df.to_html("test", columns=test)
df.to_html("test", columns=["test"])
df.to_xml("test", attr_cols=test)
df.to_xml("test", attr_cols=["test"])
df.to_xml("test", elem_cols=test)
df.to_xml("test", elem_cols=["test"])
df.columns = test
df.columns = ["test"]
testDict = {"test": 1}
df.to_string("test", col_space=testDict)
df.to_string("test", col_space={"test": 1}) |
Thanks. Addressed in next commit. I added your code as a test (after making it work at runtime) |
@twoertwein ready for review again |
Thank you @Dr-Irv ! |
mypy
has finally put in the feature allowing asymmetric getters/setters. During the testing, they had an issue with our stubs regarding where we useHashableT
. See python/mypy#18510 (comment)This fixes that issue. Then once
mypy
1.16 i released, we can fix the tests for setting columns that have# type: ignore
in it.