Categorical does not work with nan
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by reproducing the reported C(col_name) behavior with the shown values, then try Treatment(reference=nan) and inspect the resulting exception. Trace how categorical levels and missing values are identified during formula processing. Done means the categorical term creates four dummy variables and nan can be selected as the reference level without the reported error.
Written by the indexing model from the issue text.
Description
I have a columns whose unique looks like:
array([nan, 'CONFERENCE', 'ANALYST', 'FORUM', 'SEMINAR'], dtype=object)
I would expect that adding C(col_name) to the formula would create 4 dummy variables (5 values-1), bu in fact it only adds 3.
When I tried to explicitly set control to be nan, i get an exception:
C(col_name, Treatment(reference=nan))
PatsyError: specified level nan not found
- Dominant language
- Python
- Stars
- 990
- Forks
- 113
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from pydata/patsy
-
VarLookupDict should implement __iter__, causes CPython crash when using statsmodels in marimo notebookPossibly taken @kouyouqi123 claimed this 173 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Add link to license in readmePossibly taken @zheng-guannan577 claimed this 9 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Nullable pandas dtypes crash in categorical handling: "Cannot interpret 'BooleanDtype' as a data type"Possibly taken @RaphaelFakhri claimed this 15 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
cc() truncates periodic coordinates for integer input with fractional boundsPossibly taken @ktz03 claimed this 39 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
abetlen/llama-cpp-python#2424 ·
Maintainers usually reply within 1 day
-
Bug IronPython Python 3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pyrevitlabs/pyRevit#4184 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day