Error: df['Adj Close'].plot()

Error: df['Adj Close'].plot()
0.0 0

#1

Hi Everyone. New to Python here. Was wondering what this error that came up on my console is. I think I need to import some library but I’m not sure what. Everything works fine up until running this line of code.

Input:
df[‘Adj Close’].plot()
plt.show()

Console Returns:

Traceback (most recent call last):

File “”, line 1, in
df[‘Adj Close’].plot()

File “/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py”, line 2139, in getitem
return self._getitem_column(key)

File “/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py”, line 2146, in _getitem_column
return self._get_item_cache(key)

File “/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py”, line 1842, in _get_item_cache
values = self._data.get(item)

File “/anaconda3/lib/python3.6/site-packages/pandas/core/internals.py”, line 3843, in get
loc = self.items.get_loc(item)

File “/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py”, line 2527, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))

File “pandas/_libs/index.pyx”, line 117, in pandas._libs.index.IndexEngine.get_loc

File “pandas/_libs/index.pyx”, line 139, in pandas._libs.index.IndexEngine.get_loc

File “pandas/_libs/hashtable_class_helper.pxi”, line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item

File “pandas/_libs/hashtable_class_helper.pxi”, line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: ‘Adj Close’


#2

Figured it out. Syntax Error. Misnamed my column earlier