pyq icon indicating copy to clipboard operation
pyq copied to clipboard

Patch `pandas.core.dtypes.inference.is_dict_like`

Open WillDaSilva opened this issue 4 years ago • 3 comments

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. 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 #133

WillDaSilva avatar Jun 11 '21 19:06 WillDaSilva

This pull request introduces 1 alert when merging 79786e8c848c4499c4a4d573d9a46e4965897f93 into 8c31f19e6ee8970d5b4146c5593cb1ed174e1385 - view on LGTM.com

new alerts:

  • 1 for Module imports itself

lgtm-com[bot] avatar Jun 11 '21 19:06 lgtm-com[bot]

@sashkab @abalkin Is this change suitable to go in as a patch release of the interface?

cmccarthy1 avatar Jun 29 '21 13:06 cmccarthy1

@cmccarthy1 I'm leaving this to @abalkin to review.

sashkab avatar Jun 29 '21 13:06 sashkab