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

关于REF函数 #31

Closed
mickey3721 opened this issue May 12, 2022 · 2 comments
Closed

关于REF函数 #31

mickey3721 opened this issue May 12, 2022 · 2 comments

Comments

@mickey3721
Copy link

REF(price,N)N只能是整数,如果N是序列,该如何处理?

@mickey3721
Copy link
Author

try this:

def ref(data, n: int):
if n < len(data):
res = []
if n >= 0:
res[:n] = [float('nan')] * n
res[n:] = data[:-n]
else:
res[n:] = [float('nan')] * abs(n)
res[:n] = data[-n:]
else:
res = data
return np.array(res)

@jandykwan
Copy link

如果N是序列这个问题似乎还没有解决?

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

2 participants