Reputation: 1185
I have experienced the following error when I am reading a csv file.
data = pd.read_csv('C:/Users/user/Desktop/Test/my_file.csv', sep = ';', decimal=".")
data = pd.read_csv('C:/Users/user/Desktop/Test/my_file.csv', sep = ';', decimal=",")
Happens that the imported numbers are always like lower than they should be.
for example: 376362691 -> 3.763627
I can not change my csv file because it does has the right number. How can I import it properly to my python notebook?
I tried to change decimal (',' or '.') but the same mistake continues.
In my csv file looks like this:
index C V t A
1 str1 27 2.269.511.284 376.362.691
2 str2 64 1.082.040.323 1.532.261.335
However, in my data frame when I import I either have
A
376.362.691
1.532.261.335
or
A
3.76362691
15.32261335
While in my excel file the numbers mean this:
A
376362691
1532261335
Upvotes: 2
Views: 994
Reputation: 402333
Looks like you've confused the decimal
argument with thousands
:
data = pd.read_csv(
'C:/Users/user/Desktop/Test/my_file.csv',
sep = ';',
thousands="."
)
Upvotes: 2