I have a data frame of apple stock data and Close column has a few "null" strings in it. I cannot plot my data because I keep getting 'Cannot convert string to...' error. When I try the code below I get an error 'AttributeError: 'DataFrame' object has no attribute 'close_arr'. This code was based on the answer provided in this thread How to drop rows from pandas data frame that contains a particular string in a particular column?
apl = pd.read_csv(path, index_col='Date', parse_dates=True)
close_arr = aapl['Close']
aapl = aapl[~aapl.close_arr.str.contains("null")]
aapl.head()
Here is the info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 9234 entries, 1980-12-12 to 2017-07-26
Data columns (total 6 columns):
Adj Close 9234 non-null object
Close 9234 non-null object
High 9234 non-null object
Low 9234 non-null object
Open 9234 non-null object
Volume 9234 non-null object
dtypes: object(6)
memory usage: 505.0+ KB
I have also tried:
aapl = aapl[~aapl['Close'].str.contains("null")]
Where am I going wrong here?