bug-datamash
[Top][All Lists]
Advanced

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

[Bug-datamash] Decimal separator


From: Martin Heller
Subject: [Bug-datamash] Decimal separator
Date: Thu, 9 Jun 2016 23:48:54 +0200

I am not sure if the following is considered a feature or if it's a bug? 
However, it was unexpected to me that datamash on my system (Windows with 
default input language set to Danish) expects the decimal separator 
to be a comma (,) and not dot (.) as most other data processing tools. 

Here is an example demonstrating the issue:

T:\>cat data.txt
0.1
2.3
4.5
6.7
8.9
T:\>cat data.txt | datamash-win32 mean 1
datamash-win32: invalid numeric value in line 1 field 1: '0.1'

T:\>sed s/\./,/ data.txt | datamash-win32 mean 1
4,5

T:\>datamash-win32 --version
datamash (GNU datamash) 1.0.6.37-d2e0-dirty
Copyright (C) 2014 Assaf Gordon
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Assaf Gordon.

If it's a feature, I would like to propose an additional option to set the 
decimal mark on the command line.

    -d, --decimal-mark=X    Use X as decimal separator

Using my data.txt from the example above

    cat data.txt | datamash-win32 --decimal-mark=. mean 1

would then give the expected result 4.5 and 

    datamash-win32 --decimal-mark=, mean 1

would correspond to the current behavior of datamash on my system.

Best regards
Martin Heller




reply via email to

[Prev in Thread] Current Thread [Next in Thread]