It's a .csv with items and prices. The latter already come rounded (without decimal) but if the price is more than 999, then I have to deal with the thousand separator.
item, price
foo, 12
bar,678
baz, 1.200
`df.dtype` returns:
item object
price float64
If I try to convert to int
it truncates the number. So instead of 1.200 (one thousand two hundred) I get 1 (one)
Ps: I winded up deleting the dots with regex, but there has to be a proper way to handle this situation.
CodePudding user response:
As mentioned by @BigBen there's a pd.read_csv
parameter called thousands
used to indicate the thousand separator. There's also a decimal
parameter which may be useful too.