Comments (11)
似乎作者有其他的办法,但我是通过版本解决的。我的环境如下。
不过呢,环境也不一定能行。我最开始出现这个问题的时候我和别人对其了环境,可是很奇怪,版本都对齐了,我还是不能运行。后面我又找了个人对齐了环境,就能运行了,最后我能用的环境如下:
alphalens 0.4.0
numpy 1.24.4
pandas 1.3.4
Python 3.8.18
from alphalens.
Make sure you’re on alphalens-reloaded and not alphalens (not supported anymore). The former supports the latest version of pandas, but the latter doesn’t.
from alphalens.
set keepdims=True
delta_days = period_len.components.days - mode(days_diffs, keepdims=True).mode[0]
from alphalens.
set keepdims=True delta_days = period_len.components.days - mode(days_diffs, keepdims=True).mode[0]
Thanks JiwenZ! I haven't try out your solution, but I solved by re-install different version of Pandas or Numpy or Python, i don't know which of it is the factor. Here is a list of enviroment version, which i tested, it can run well:
alphalens 0.4.0
numpy 1.24.4
pandas 1.3.4
Python 3.8.18
from alphalens.
你好,我现在也碰到了跟你一模一样的问题,将factor和price数据表都准备好了,运行get_clean_factor_and_forward_returns函数总是报错IndexError: invalid index to scalar variable,换了好多个数据表,都报这个错,这只能通过降低版本来解决吗?
from alphalens.
pandas 1.4.4 also works
from alphalens.
changed to mode([days_diffs]).mode can also 真 无语
from alphalens.
I am having the same error. Changing to: delta_days = period_len.components.days - mode(days_diffs, keepdims=True).mode[0] or mode([days_diffs]).mode did not work. I get the following error:
AssertionError: Length of new_levels (3) must be <= self.nlevels (2)
Any idea how to solve?
from alphalens.
I am having the same error. Changing to: delta_days = period_len.components.days - mode(days_diffs, keepdims=True).mode[0] or mode([days_diffs]).mode did not work. I get the following error:
AssertionError: Length of new_levels (3) must be <= self.nlevels (2)
Any idea how to solve?
Your mistake is different from mine. Try something else
from alphalens.
I am having the same error. Changing to: delta_days = period_len.components.days - mode(days_diffs, keepdims=True).mode[0] or mode([days_diffs]).mode did not work. I get the following error:
AssertionError: Length of new_levels (3) must be <= self.nlevels (2)
Any idea how to solve?
I modified like that and also found that error, that seems, pandas version should < 2.1(or fix source code too...).
And when I use version 2.0.2, it will raise another error with "TypeError: incompatible index of inserted column with frame index"...
Finally, I use 1.3.4, works fine.
from alphalens.
Make sure you’re on alphalens-reloaded and not alphalens (not supported anymore). The former supports the latest version of pandas, but the latter doesn’t.
You're right, I'm just on alphalens, and I find the forked project alphalens-reloaded now, will try that in future, thx.
from alphalens.
Related Issues (20)
- freq error: freq must be Day, BDay or CustomBusinessDay HOT 1
- How can I build my confidence that my strategy returns better HOT 1
- ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' HOT 6
- cumulative_returns calculation no longer adjusts for periods > 1?
- When I use "bins" instead of "quantiles", it went wrong
- UnboundLocalError: local variable 'period_len' referenced before assignment HOT 1
- Problem:create_event_returns_tear_sheet
- Dropped 45.5% entries from factor data: 45.5% in forward returns computation and 0.0% in binning phase (set max_loss=0 to see potentially suppressed Exceptions)
- Anyone can explain how the factors are bined? HOT 2
- Alphalens
- MissingDataError: exog contains inf or nans HOT 2
- importing alphalens 0.3.6 gets error "No module named 'pandas.util._decorators'" HOT 1
- AttributeError: 'Int64Index' object has no attribute 'tz' HOT 2
- Is alphalens still used? HOT 1
- got error: Error: No such keys(s): 'mode.use_inf_as_null'
- data = al.utils.get_clean_factor_and_forward_returns(cs_df.stack(), pricing, quantiles=5, bins=None, periods=[1])
- Unable to work with pyfolio integration
- cant install alphalens from pip because of outdated configparser method call
- STOP USING WRITING READING
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alphalens.