Transforms like 'scale' need some way to handle missing data
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 990
- Forks
- 106
- Avg merge
- 7d 34m
- Merged PRs (30d)
- 1
Description
In[92]: df = pd.DataFrame([(1,3),(2,6),(4,2),(6,5),(7,3),(4,6),(2,2),(6,4)], columns=['y','X'])
In[93]: pt.dmatrices('y ~ X.diff()', df)
Out[93]:
(DesignMatrix with shape (7, 1)
y
2
4
6
7
4
2
6
Terms:
'y' (column 0),
DesignMatrix with shape (7, 2)
Intercept X.diff()
1 3
1 -4
1 3
1 -2
1 3
1 -4
1 2
Terms:
'Intercept' (column 0)
'X.diff()' (column 1))
In[94]: pt.dmatrices('y ~ scale(X.diff())', df)
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\IPython\core\formatters.py", line 222, in catch_format_error
r = method(self, *args, **kwargs)
File "C:\Python34\lib\site-packages\IPython\core\formatters.py", line 699, in __call__
printer.pretty(obj)
File "C:\Python34\lib\site-packages\IPython\lib\pretty.py", line 368, in pretty
return self.type_pprinters[cls](obj, self, cycle)
File "C:\Python34\lib\site-packages\IPython\lib\pretty.py", line 552, in inner
p.pretty(x)
File "C:\Python34\lib\site-packages\IPython\lib\pretty.py", line 382, in pretty
return meth(obj, self, cycle)
File "C:\Python34\lib\site-packages\patsy\design_info.py", line 1089, in _repr_pretty_
for col in formatted_cols]
File "C:\Python34\lib\site-packages\patsy\design_info.py", line 1089, in <listcomp>
for col in formatted_cols]
ValueError: max() arg is an empty sequence
Out[94]:
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
The issue provides a reproducible pandas DataFrame and pt.dmatrices example; start by running the scale(X.diff()) case and comparing it with X.diff(). Trace how missing values from the transform are handled, with completion defined as a non-crashing result for this expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100