-
- Notifications
You must be signed in to change notification settings - Fork 19.2k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Description
Looks like the pandas rolling methods only support numpy arrays, while numpy and bottleneck methods also support lists for convenience:
>>> l = [1,2,3,4] >>> import numpy as np >>> np.cumsum(l) array([ 1, 3, 6, 10]) >>> import bottleneck as bn >>> bn.move_sum(l, 1) array([ 1., 2., 3., 4.]) >>> import pandas >>> pandas.rolling_sum(l, 1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/pandas-0.10.1-py2.7-linux-x86_64.egg/pandas/stats/moments.py", line 507, in f time_rule=time_rule, **kwargs) File "/usr/lib/python2.7/site-packages/pandas-0.10.1-py2.7-linux-x86_64.egg/pandas/stats/moments.py", line 281, in _rolling_moment return_hook, values = _process_data_structure(arg) File "/usr/lib/python2.7/site-packages/pandas-0.10.1-py2.7-linux-x86_64.egg/pandas/stats/moments.py", line 325, in _process_data_structure if not issubclass(values.dtype.type, float): AttributeError: 'list' object has no attribute 'dtype' Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode