Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of pandas.
[ ] (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample
data.csv
key,value
a,1.234
b,"1,234.00"
c,":"
Reading the data works ok without parsing the numbers
>>> pd.read_csv('data.csv')
key value
0 a 1.234
1 b 1,234.00
2 c :
When parsing numbers it fails even when the correct thousand separator is set:
>>> pd.read_csv('data.csv', dtype={'value': float}, thousands=',')
ValueError: could not convert string to float: '1,234.00'
However, with the right N/A value setting it works
pd.read_csv('data.csv', dtype={'value': float}, thousands=',', na_values=':')
key value
0 a 1.234
1 b 1234.000
2 c NaN
Problem description
I think the error message saying that pandas could not convert value "1,234.00" to a number is uninformative as the error is rather in the missing value ":".
Might be related to #2570.
Expected Output
I’d expect the error message should be about the non-parsable value ":".
Code Sample
data.csv
Reading the data works ok without parsing the numbers
When parsing numbers it fails even when the correct thousand separator is set:
However, with the right N/A value setting it works
Problem description
I think the error message saying that pandas could not convert value "1,234.00" to a number is uninformative as the error is rather in the missing value ":".
Might be related to #2570.
Expected Output
I’d expect the error message should be about the non-parsable value ":".
Output of
pd.show_versions()