Skip to content
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

'Index' object has no attribute 'get_values #379

Open
raoraozu opened this issue May 13, 2020 · 3 comments
Open

'Index' object has no attribute 'get_values #379

raoraozu opened this issue May 13, 2020 · 3 comments

Comments

@raoraozu
Copy link

Problem Description

Hi all, I re-ran the same code which worked well before but I am getting this error since I updated my alphalens. Is there anyone who can help? Thanks!

this is the factor_data I have

image

Please provide a minimal, self-contained, and reproducible example:

al.tears.create_full_tear_sheet(
                                factor_data,
                                long_short=True,
                                group_neutral=False,
                                by_group=False,
                            )

Please provide the full traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-04b4e6f008b9> in <module>
      3                                 long_short=True,
      4                                 group_neutral=False,
----> 5                                 by_group=False,
      6                             )# alpha_191.097

C:\ProgramData\Anaconda3\lib\site-packages\alphalens\plotting.py in call_w_context(*args, **kwargs)
     43             with plotting_context(), axes_style(), color_palette:
     44                 sns.despine(left=True)
---> 45                 return func(*args, **kwargs)
     46         else:
     47             return func(*args, **kwargs)

C:\ProgramData\Anaconda3\lib\site-packages\alphalens\tears.py in create_full_tear_sheet(factor_data, long_short, group_neutral, by_group)
    524         factor_data, group_neutral, by_group, set_context=False
    525     )
--> 526     create_turnover_tear_sheet(factor_data, set_context=False)
    527 
    528 

C:\ProgramData\Anaconda3\lib\site-packages\alphalens\plotting.py in call_w_context(*args, **kwargs)
     45                 return func(*args, **kwargs)
     46         else:
---> 47             return func(*args, **kwargs)
     48     return call_w_context
     49 

C:\ProgramData\Anaconda3\lib\site-packages\alphalens\tears.py in create_turnover_tear_sheet(factor_data, turnover_periods)
    431     if turnover_periods is None:
    432         input_periods = utils.get_forward_returns_columns(
--> 433             factor_data.columns, require_exact_day_multiple=True,
    434         ).get_values()
    435         turnover_periods = utils.timedelta_strings_to_integers(input_periods)

AttributeError: 'Index' object has no attribute 'get_values'

Please provide any additional information below:

Versions

  • Alphalens version: '0.4.0'
  • Python version: 3.7
  • Pandas version: '1.0.1'
  • Matplotlib version:
@Vinayak285
Copy link

I know this might be a little late. But the problem is that get_values() has been deprecated (around 0.25.0) and they recommend using to_numpy() function instead. So, go to your tears.py file and change the get_values() function to to_numpy() and it should work (worked in my case as I was having the same problem).

@letianzj
Copy link

@Vinayak285 confirmed it works in my case too. Thanks.

@VoidFly
Copy link

VoidFly commented Nov 5, 2020

Or you can just remove the 'get_values()', it works in my case

Subhanimuhammed added a commit to Subhanimuhammed/alphalens that referenced this issue Jan 26, 2021
get_values not working for latest versions so adding to_numpy method as per quantopian#379
shlomiku added a commit to shlomiku/alphalens that referenced this issue Mar 24, 2021
shlomiku added a commit to shlomiku/zipline-trader that referenced this issue Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants