py-why / py-why/EconML

Strange compatibility issue with pandas

Open
#688 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.8k
Forks
827
PR merge metrics
No merged PRs in 30d

Description

Hello, I am finding a strange issue where pandas breaks after I import some features from econml. For instance, if I want to inspect the label column:
df['label' works fine with no econml imports. But it throws an exception after importing:
from econml.dml import LinearDML, CausalForestDML

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.8/site-packages/sympy/interactive/printing.py", line 27, in _displayhook print(stringify_func(arg, **settings)) File "/usr/local/lib/python3.8/site-packages/sympy/printing/printer.py", line 372, in __call__ return self.__wrapped__(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/sympy/printing/pretty/pretty.py", line 2871, in pretty return pp.doprint(expr) File "/usr/local/lib/python3.8/site-packages/sympy/printing/pretty/pretty.py", line 66, in doprint return self._print(expr).render(**self._settings) File "/usr/local/lib/python3.8/site-packages/sympy/printing/printer.py", line 331, in _print return printmethod(expr, **kwargs) File "/usr/local/lib/python3.8/site-packages/sympy/printing/pretty/pretty.py", line 999, in _print_Series args = list(expr.args) File "/usr/local/lib/python3.8/site-packages/pandas/core/generic.py", line 5487, in __getattr__ return object.__getattribute__(self, name) AttributeError: 'Series' object has no attribute 'args'

What am I missing here?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with Python 3.8 by importing pandas, then LinearDML and CausalForestDML from econml.dml, and inspecting the label column. Start with the supplied traceback, particularly the interaction with SymPy's display hook and pandas Series. Done means the reported column inspection no longer raises this exception after the econml imports, with the behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.