need some help here to eliminate this error. Here is the code - the # was the original code which running wonderful and I tried to adapt:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.stattools import adfuller
from genhurst import genhurst
from datetime import datetime
import pandas_datareader as pdr
df = pdr.DataReader('BTC-USD', 'yahoo', datetime(2014,1,1), datetime(2019,10,25))
# df=pd.read_csv('inputData_USDCAD.csv')
y=df.loc[df['Adj Close']]
# y=df.loc[df['Time']==1659, 'Close']
results=adfuller(y, maxlag=1, regression='c', autolag=None)
print(results)
# Find Hurst exponent
H, pVal=genhurst(np.log(y))
print("H=%f pValue=%f" % (H, pVal))
Those are the error messages:
File "", line 14, in y=df.loc[df['Adj Close']]
File "C:\Users\apros\Anaconda3\lib\site-packages\pandas\core\indexing.py", line 1424, in getitem return self._getitem_axis(maybe_callable, axis=axis)
File "C:\Users\apros\Anaconda3\lib\site-packages\pandas\core\indexing.py", line 1839, in _getitem_axis return self._getitem_iterable(key, axis=axis)
File "C:\Users\apros\Anaconda3\lib\site-packages\pandas\core\indexing.py", line 1133, in _getitem_iterable keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
File "C:\Users\apros\Anaconda3\lib\site-packages\pandas\core\indexing.py", line 1089, in _get_listlike_indexer keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr)
File "C:\Users\apros\Anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 3443, in _reindex_non_unique indexer, missing = self.get_indexer_non_unique(target)
File "C:\Users\apros\Anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 4801, in get_indexer_non_unique indexer, missing = self._engine.get_indexer_non_unique(tgt_values)
File "pandas_libs\index.pyx", line 295, in pandas._libs.index.IndexEngine.get_indexer_non_unique
TypeError: 'NoneType' object is not iterable
df['Adj Close']what do you see if you doprint(type(df['Adj Close']), "\n", df['Adj Close'])df.loc[df['Adj Close']]is probably wrong - i guess you probably wantdf.loc[df['Adj Close'] == 'some condition']?df['Adj Close']is a series of floats. So I am not sure what you are expecting to do with theloc()method here when you are not filtering on any condition. Maybe edit your question to explain what your trying to achievey=df.loc[df['Adj Close'] < 200]this will return you a df of[2 rows x 6 columns]