close

[Solved] KeyError: “None of [[”, ”]] are in the [columns]” pandas python

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error KeyError: “None of [[”, ”]] are in the [columns]” pandas python in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How KeyError: “None of [[”, ”]] are in the [columns]” pandas python Error Occurs?

Today I get the following error KeyError: “None of [[”, ”]] are in the [columns]” pandas python in python.

How To Solve KeyError: “None of [[”, ”]] are in the [columns]” pandas python Error ?

  1. How To Solve KeyError: “None of [['', '']] are in the [columns]” pandas python Error ?

    To Solve KeyError: “None of [['', '']] are in the [columns]” pandas python Error If you have any white spaces in the data you're will get an error, so delim_whitespace is included to remove those in case they're in the data.

  2. KeyError: “None of [['', '']] are in the [columns]” pandas python

    To Solve KeyError: “None of [['', '']] are in the [columns]” pandas python Error If you have any white spaces in the data you're will get an error, so delim_whitespace is included to remove those in case they're in the data.

Solution 1

By the print you posted, it seems like you have whitespaces as delimiters. pd.read_csv will read using , as default separator, so you have to explicitly state it:

pd.read_csv('source.txt',header=0, delim_whitespace=True)

Solution 2

You can try doing this:

pd.read_csv('source.txt',header=0, delim_whitespace=True)

If you have any white spaces in the data you’re will get an error, so delim_whitespace is included to remove those in case they’re in the data.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read