"+ -1" equivalence with "-1" in patsy formula?
@matthewwardrop is already working on this.
Since Sep 25, 2021.
Assessment
This issue has not been assessed yet.
Description
As per patsy's documentation, the following results in a design matrix with no intercept:
>>> patsy.dmatrix('a + b - 1',
pandas.DataFrame({'a':[1,2], 'b':[3,4]}))
DesignMatrix with shape (2, 2)
a b
1 3
2 4
Terms:
'a' (column 0), 'b' (column 1)
The documentation seems to imply that appending + -1 to the formula a + b should have the same effect as appending '-1'; however, it doesn't seem that the intercept is removed for the former:
>>> patsy.dmatrix('a + b + -1',
pandas.DataFrame({'a':[1,2],'b':[3,4]}))
DesignMatrix with shape (2, 3)
Intercept a b
1 1 3
1 2 4
Terms:
'Intercept' (column 0)
'a' (column 1)
'b' (column 2)
Is the above expected?
I'm using patsy 0.5.1 with python 3.7.6 and pandas 1.0.5.
- Dominant language
- Python
- Stars
- 990
- Forks
- 106
- Avg merge
- 7d 34m
- Merged PRs (30d)
- 1
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.
More from pydata/patsy
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100