osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading 'scientific' csv using Pandas?


Den 2018-11-19 skrev Peter Otten <__peter__ at web.de>:
> Martin Sch??n wrote:
>
>> My pandas is up to date.
>> 
>
> The engine="python" produces an exception over here:
>
> """
> ValueError: The 'decimal' option is not supported with the 'python' engine
> """
>
> Maybe you can try and omit that option?

Bingo!
No, I don't remember why I added that engine thing. It was two days ago!

> If that doesn't work you can specify a converter:
>
>>>> pd.read_csv("file.csv", sep="\t", converters={0: lambda s: 
> float(s.replace(",", "."))})
>            col1  col2
> 0  1.100000e+00     0
> 1  1.024000e-04     1
> 2  9.492000e-10     2
>
> [3 rows x 2 columns]
>
I save that one for later. One never nows...

/Martin