Reading 'scientific' csv using Pandas?
Martin Schöön
martin.schoon at gmail.com
Mon Nov 19 15:59:44 EST 2018
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
More information about the Python-list
mailing list