\n
Adding screenshot of TSV file\n
Reputation: 1186
I am facing issue while loading data a tab separated file with pandas. It assigns the first columns as index and whole data is shifted to the left. The abstract column as a result has NaN value. If I do reset_index on the dataframe, it will drop the index. How to fix this issue.
data = pd.read_csv(file_path, sep='\t')
data.head()
Upvotes: 1
Views: 379
Reputation: 978
According to the docs, setting index_col=False
when reading the CSV can be used to force pandas to not use the first column as the index.
Upvotes: 0
Reputation: 692
Please try the below code...
data = pd.read_csv(file_path, sep='\t')
data.drop(index=0, inplace=True)
data.head()
Upvotes: 1