Skip to content

BUG: Series _transform_fast fails for datetime with null groups #13191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chris-b1 opened this issue May 15, 2016 · 0 comments
Closed

BUG: Series _transform_fast fails for datetime with null groups #13191

chris-b1 opened this issue May 15, 2016 · 0 comments
Milestone

Comments

@chris-b1
Copy link
Contributor

xref #10972 - but not the same issue. I've got a fix for this + #12737 coming.

Code Sample, a copy-pastable example if possible

In [20]: df = pd.DataFrame({'grouping':[np.nan,1,1,3], 
                            'v':[1.1, 2.1, 3.1, 4.5], 
                            'd':pd.date_range('2014-1-1','2014-1-4')})

In [21]: df.groupby('grouping')['d'].transform('first')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-21-cb1ed73aabc3> in <module>()
----> 1 df.groupby('grouping')['d'].transform('first')

C:\Users\Chris\Anaconda\lib\site-packages\pandas\core\groupby.pyc in transform(self, func, *args, **kwargs)
   2738                 # cythonized aggregation and merge
   2739                 return self._transform_fast(
-> 2740                     lambda: getattr(self, func)(*args, **kwargs))
   2741
   2742         # reg transform

C:\Users\Chris\Anaconda\lib\site-packages\pandas\core\groupby.pyc in _transform_fast(self, func)
   2781         out = func().values[ids]
   2782         if not mask.all():
-> 2783             out = np.where(mask, out, np.nan)
   2784
   2785         obs = np.zeros(ngroup, dtype='bool')

TypeError: invalid type promotion
@jreback jreback added this to the 0.18.2 milestone May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants