Dataframe set_index function returning error
Look at journals.columns. You can only use columns that are in the DataFrame. JnlNo is not in the dataframe as the error message tells you. Maybe you're confusing an uppercase i with a lowercase L or something like that.
I have a dataframe and am trying to set the index to the column 'JnlNo'. Currently the index is just a row number. The JnlNo are integers. But it keeps returning this error:

KeyError                                  Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_52996/1782638178.py in 
----> 1 journals=journals.set_index('JnlNo')
~\Anaconda3\lib\site-packages\pandas\util_decorators.py in wrapper(*args, **kwargs)
309                     stacklevel=stacklevel,
310                 )
--> 311             return func(*args, **kwargs)
312
313         return wrapper
~\Anaconda3\lib\site-packages\pandas\core\frame.py in set_index(self, keys, drop, append, inplace, verify_integrity)
5449
5450         if missing:
-> 5451             raise KeyError(f"None of {missing} are in the columns")
5452
5453         if inplace:
KeyError: "None of ['JnlNo'] are in the columns"
I have initially ran these codes
import pandas as pd
journals = pd.read_csv('Journals.csv')
journals.head()
but when I then went ahead to set_index
journals=journals.set_index('JnlNo'), it returned the error.