Den 2018-11-18 skrev Stefan Ram <r...@zedat.fu-berlin.de>: > Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= <martin.sch...@gmail.com> writes: >>to read from such files. This works so so. 'Common floats' (3,1415 etc) >>works just fine but 'scientific' stuff (1,6023e23) does not work. > > main.py > > import sys > import pandas > import locale > print( sys.version ) > print( pandas.__version__ ) > with open( 'schoon20181118232102.csv', 'w' ) as file: > print( 'col0\tcol1', file=file, flush=True ) > print( '1,1\t0', file=file, flush=True ) > print( '10,24e-05\t1', file=file, flush=True ) > print( '9,492e-10\t2', file=file, flush=True ) > EUData = pandas.read_csv\ > ( 'schoon20181118232102.csv', sep='\t', decimal=',', engine='python' ) > locale.setlocale( locale.LC_ALL, 'de' ) > print( 2 * locale.atof( EUData[ 'col0' ][ 1 ])) > > transcript > > 3.7.0 > 0.23.4 > 0.0002048 > Thanks, I just tried this. The line locale.setlocale... throws an error:
"locale.Error: unsupported locale setting" Trying other ideas instead of 'de' results in more of the same. '' results in no errors. The output I get is this: 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] 0.22.0 0.0002048 Scratching my head and speculating: I run this in a Virtualenv I have created for Jupyter and pandas and whatever I feel I need for this. Could locale be undefined or something that causes this? /Martin -- https://mail.python.org/mailman/listinfo/python-list