ValueError: make_column_selector can only be applied to pandas dataframes
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.8k
- Forks
- 827
- PR merge metrics
- No merged PRs in 30d
Description
when call ForestDRLearner,
set model_regression=make_pipeline(ordinal_encoder,HistGradientBoostingClassifier()),
set ordinal_encoder=make_column_transformer( (OrdinalEncoder(), make_column_selector()), remainder='passthrough')
ps.omitted some unimportant parameters.
then report error:
pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
ValueError Traceback (most recent call last)
in
2 est = ForestDRLearner(model_regression=clfY,
3 model_propensity=clf)
----> 4 est.fit(y, T=T, X=X)
/conda/envs/notebook/lib/python3.6/site-packages/econml/dr/_drlearner.py in fit(self, Y, T, X, W, sample_weight, groups, cache_values, inference)
......
......
/conda/envs/notebook/lib/python3.6/site-packages/sklearn/compose/_column_transformer.py in call(self, df)
825 """
826 if not hasattr(df, 'iloc'):
--> 827 raise ValueError("make_column_selector can only be applied to "
828 "pandas dataframes")
829 df_row = df.iloc[:1]
ValueError: make_column_selector can only be applied to pandas dataframes
I guess econML use some not dataframe to call fit. am I right? does this need fix?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ForestDRLearner.fit in econml/dr/_drlearner.py and reproduce the supplied pipeline using make_column_transformer, make_column_selector, and HistGradientBoostingClassifier. Check how the learner passes X into the scikit-learn pipeline; done means the reported configuration either fits successfully with pandas dataframes or the incompatibility is clearly documented and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python, scikit-learn
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100