pmorissette / ffn

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

AttributeError: 'DataFrame' object has no attribute 'ix' #109

Closed mtvu closed 3 years ago

mtvu commented 3 years ago

Error when running this example ( ffn v.0.3.4 , pandas v1.1.3)

perf['spy'].display_monthly_returns()

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-27-b4fbe78f35ac> in <module>
      1 # we can also use perf[2] in this case
----> 2 perf['spy'].display_monthly_returns()
      3 perf[2].plot_histogram()

~/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/ffn/core.py in display_monthly_returns(self)
    499                  'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'YTD']]
    500         for k in self.return_table.index:
--> 501             r = self.return_table.ix[k].values
    502             data.append([k] + [fmtpn(x) for x in r])
    503         print(tabulate(data, headers='firstrow'))

~/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5137             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5138                 return self[name]
-> 5139             return object.__getattribute__(self, name)
   5140 
   5141     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'ix'
timkpaine commented 3 years ago

Duplicate https://github.com/pmorissette/ffn/issues/107