-
Notifications
You must be signed in to change notification settings - Fork 49
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
Patch pandas.core.dtypes.inference.is_dict_like
#141
base: master
Are you sure you want to change the base?
Conversation
Pandas thinks all non-atom K objects are dicts, which leads to issues like KxSystems#133. This commit provides a hacky solution to this problem by overwriting the `__code__` attribute of the function Pandas uses for checking if an object is dict-like. Patching the function through safer means (e.g. with `unittest.mock`) won't work well because the function is imported all over Pandas, and we would have to patch all of them. Fixes KxSystems#133
This pull request introduces 1 alert when merging 79786e8 into 8c31f19 - view on LGTM.com new alerts:
|
@@ -9,6 +9,9 @@ doc/_build/ | |||
src/pyq/version.py | |||
html/ | |||
|
|||
.venv*/ | |||
venv*/ |
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.
this doesn't belong here.
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.
Would you rather a separate PR just for this change? The .gitignore
should exclude Python virtual environments in some capacity.
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.
I don't believe venvs belong in code repository. For example, I keep my venvs in the .virtualenvs
directory. Adding all possible locations will grow .gitignore
dramatically and this is not necessary.
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.
Per-project virtual environments are a widespread practice. You'll find most large Python projects have a few lines in their .gitignore
to exclude them. Besides, we don't need to add "all possible locations" - no need to let perfect be the enemy of good. This addition takes care of all of the most common ones in just two lines.
@cmccarthy1 I'm leaving this to @abalkin to review. |
Pandas thinks all non-atom K objects are dicts, which leads to issues like #133. This PR provides a hacky solution to this problem by overwriting the
__code__
attribute of the function Pandas uses for checking if an object is dict-like. Patching the function through safer means (e.g. withunittest.mock
) won't work well because the function is imported all over Pandas, and we would have to patch all of them.Fixes #133