clararobayo / google-refine

Automatically exported from code.google.com/p/google-refine
0 stars 0 forks source link

ToNumber should try to convert to integer first #537

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When taking a column that is of a 'number' type and applying a transformation 
to change it to a column that is of a 'text' type, the data contained within 
the cells of that column end up having a decimal and a zero suffixed to it. 

For example, if the 'number' column(before the transformation) contained data 
such as this in the first 10 rows:
21
20
19
17
3
4
5
16
15
14

Then after the transformation(from 'number' to 'text') the data ends up like 
this:
21.0
20.0
19.0
17.0
3.0
4.0
5.0
16.0
15.0
14.0
(see the attached screenshots, before.png='number', after.png='text').

In my opinion, this seems a bit backwards, meaning, I would expect this 
behavior if I had a column that is of a 'text' type and am transforming it to a 
'number' type, but even then I feel it should not auto-add the decimal point 
and trailing zero... this is something the user should invoke because s/he 
wishes to.

Thanks,

Eric Jarvies

Original issue reported on code.google.com by ericjarv...@gmail.com on 26 Feb 2012 at 2:25

Attachments:

GoogleCodeExporter commented 9 years ago
I think the problem is actually on the conversion to number.  We're handling 
number parsing inconsistently between the importers where we attempt to convert 
to an integer first and only if that fails convert to floating point vs in the 
toNumber() function where we always convert to floating point.

Original comment by tfmorris on 26 Feb 2012 at 5:09

GoogleCodeExporter commented 9 years ago
Fixed in r2446.

Original comment by tfmorris on 26 Feb 2012 at 5:27

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 8 Mar 2012 at 3:06

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 18 Sep 2012 at 3:05