How can i fetch only this Symbol column from my Dataframe?

I have a Bhav Copy Dataframe which is I Downloaded from NSE website. enter image description here

And In this Dataset I just wanna print Symbol Column.

print(bhav_copy['SYMBOL'])

but it is giving me this error, enter image description here

Sorry, I don't know what to say about this column name series in which only the Symbol column stored in a different format and other column stores in a different format in Bhav Copy Dataframe.


Solution 1:

KeyError exception happened when there is a mistake in column name

Check your SYMBOL column name if it spelled correctly and be carful column name is Case Sensitive, you can check columns names in Dataframe by using:

bhav_copy.columns

It should be formatted like that to print specific column data from a Dataframe:

bhav_copy[["SYMBOL"]]
bhav_copy["SYMBOL"]

The single bracket version gives a Pandas Series, the double bracket version gives a Pandas DataFrame.

For more info on this topic check this reference.