pmorissette / ffn

ffn - a financial function library for Python
pmorissette.github.io/ffn
MIT License
1.96k stars 294 forks source link

TypeError: last() takes exactly 2 arguments (1 given) #52

Closed danwahl closed 6 years ago

danwahl commented 6 years ago

Trying to run the first example from bt and getting the following error in ffn:

  File "/home/dan/.virtualenvs/landscape/lib/python2.7/site-packages/ffn/core.py", line 1087, in calc_perf_stats
    return PerformanceStats(prices)

  File "/home/dan/.virtualenvs/landscape/lib/python2.7/site-packages/ffn/core.py", line 65, in __init__
    self._update(self.prices)

  File "/home/dan/.virtualenvs/landscape/lib/python2.7/site-packages/ffn/core.py", line 84, in _update
    self._calculate(obj)

  File "/home/dan/.virtualenvs/landscape/lib/python2.7/site-packages/ffn/core.py", line 165, in _calculate
    self.daily_prices = obj.resample('D').last()

TypeError: last() takes exactly 2 arguments (1 given)

Is this supposed to be calling last() from pandas (which seems to require an offset argument)?

JordanPlatts commented 6 years ago

It is calling last() from Pandas but it is supposed to be calling it on the Resampler object and not on a DataFrame directly.

Maybe your DataFrame doesn't have datetimes as the index?

JordanPlatts commented 6 years ago

I am going to close this issue. Reopen it if this didn't solve your problem.