Reputation: 681
I am trying to run an ADF-test from the statsmodels' adfuller module. It gives me an error:
ValueError: array must not contain infs or NaNs
Via another question I could replace my NaNs (NaN in data frame: when first observation of time series is NaN, frontfill with first available, otherwise carry over last / previous observation.
Although I checked for NaNs and inf:
df[pd.isnull(df).any(axis=1)]
np.isinf(df).any()
np.isnan(df).any()
which gives me "no results" for the pandas statement and both "false" for the numpy statements, my function still tells me the same error.
Is there a bug?
ValueError: array must not contain infs or NaNs during Biclustering
Upvotes: 1
Views: 2923
Reputation: 681
I have solved it now via:
x = pd.DataFrame(x.replace([np.inf, -np.inf], np.nan))
x = x.fillna(method='ffill')
x = x.fillna(method='bfill')
x = x.iloc[:, 0]
which gives me a x series without any nan of inf. Problem was the switch from series to dataframe and the back to series
Upvotes: 1