Nicholas Andrade
Nicholas Andrade

Reputation: 49

Values of one column appears in another column with read_csv Pandas

I'm having a trouble when I'm using .read_csv(data.csv,dtype = str),

When I run the code, for some reason, some few values of one columns appears in other columns, like that:

Data.csv before reading:

Id Info1 Info2 Info3
01 a1    b1     c1
02 a2    b2     c2
03 a3    b3     c3
04 a4    b4     c4

Command used to read on Python:

import pandas as pd

Data = pd.read_csv('Data.csv', dtype=str)

Data.csv after the read_csv command:

Id Info1 Info2 Info3
01 a1    b1     c1
02 a2    b2     c2
03 a3    b3     c3
04       a4     b4

It's sounds like for some rows it's not reading the correct column value and putting another in the place.

Someone can help me with that, please?

Upvotes: 0

Views: 201

Answers (1)

maryam_k
maryam_k

Reputation: 126

I did what you did and everything is fine

import pandas as pd
pd.read_csv('Book1.csv', dtype=str)

enter image description here

Double checking your data may help

Upvotes: 1

Related Questions