Skip to content

NumPy reductions don't work with convert / TimeGrouper #1045

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
wesm opened this issue Apr 13, 2012 · 0 comments
Closed

NumPy reductions don't work with convert / TimeGrouper #1045

wesm opened this issue Apr 13, 2012 · 0 comments
Labels
Bug Datetime Datetime data dtype Groupby
Milestone

Comments

@wesm
Copy link
Member

wesm commented Apr 13, 2012

(1 + returns).convert('BM', how=np.cumprod)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/wesm/code/rapidquant/<ipython-input-22-c8b05a51e175> in <module>()
----> 1 (1 + returns).convert('BM', how=np.cumprod)

/home/wesm/code/pandas/pandas/core/generic.pyc in convert(self, rule, method, how, axis, as_index, closed, label)
    176                 how = translate_grouping(how)
    177 
--> 178             result = grouped.agg(how)
    179         else:
    180             # upsampling

/home/wesm/code/pandas/pandas/core/groupby.pyc in agg(self, func, *args, **kwargs)
    245         See docstring for aggregate
    246         """
--> 247         return self.aggregate(func, *args, **kwargs)
    248 
    249     def _iterate_slices(self):

/home/wesm/code/pandas/pandas/core/groupby.pyc in aggregate(self, func_or_funcs, *args, **kwargs)
   1195                 return self._python_agg_general(func_or_funcs, *args, **kwargs)
   1196             except Exception:
-> 1197                 result = self._aggregate_named(func_or_funcs, *args, **kwargs)
   1198 
   1199             index = Index(sorted(result), name=self.grouper.names[0])

/home/wesm/code/pandas/pandas/core/groupby.pyc in _aggregate_named(self, func, *args, **kwargs)
   1266         result = {}
   1267 
-> 1268         for name in self.grouper:
   1269             grp = self.get_group(name)
   1270             grp.name = name

/home/wesm/code/pandas/pandas/core/groupby.pyc in __iter__(self)
    448 
    449     def __iter__(self):
--> 450         return iter(self.indices)
    451 
    452     def numkeys(self):

/home/wesm/code/pandas/pandas/_tseries.so in pandas._tseries.cache_readonly.__get__ (pandas/src/tseries.c:111266)()

/home/wesm/code/pandas/pandas/core/groupby.pyc in indices(self)
    491     @cache_readonly
    492     def indices(self):
--> 493         if len(self.groupings) == 1:
    494             return self.groupings[0].indices
    495         else:

AttributeError: 'TimeGrouper' object has no attribute 'groupings'

(1 + returns).convert('BM', how=np.cumprod)
@wesm wesm closed this as completed in ad9cffd Apr 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Groupby
Projects
None yet
Development

No branches or pull requests

1 participant