I'm trying to create a dataframe of a csv file that has 4 empty columns. When I open it on LibreOffice or Excel it correctly identifies the empty columns. However, opening with pd.read_csv()
ends up shifting the columns' values by one.
How can I solve this? It seems like a problem with pandas read_csv()
method.
My code is really standard:
import pandas as pd
df = pd.DataFrame.read_csv('csv_file.csv', sep=',')
df.head()
I changed the headers and used this:
df = pd.DataFrame.read_csv('csv_file.csv', sep=',', index_col=False).
This solved the problem, but what in my previous headers was causing this?