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

Getting error when working with a dataframe with zeros #295

Open
Karlheinzniebuhr opened this issue Apr 26, 2022 · 0 comments
Open

Getting error when working with a dataframe with zeros #295

Karlheinzniebuhr opened this issue Apr 26, 2022 · 0 comments

Comments

@Karlheinzniebuhr
Copy link

I'm initializing a dataframe with zeros to then progressively adding data to it. While calling ema_indicator() at each iteration

zeros = np.zeros(1000)
df = pd.DataFrame(zeros)
ema_indicator(df, 1000)

This gives me an exception

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ta/trend.py", line 1126, in ema_indicator
    return EMAIndicator(close=close, window=window, fillna=fillna).ema_indicator()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ta/trend.py", line 171, in ema_indicator
    return pd.Series(ema_, name=f"ema_{self._window}")
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/core/series.py", line 367, in __init__
    if is_empty_data(data) and dtype is None:
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/core/construction.py", line 818, in is_empty_data
    is_simple_empty = is_list_like_without_dtype and not data
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 1527, in __nonzero__
    raise ValueError(
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
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

1 participant