Correct text file numbers as scientific notation

Hi everyone, I hope you are doing well,

I am trying to load a text file that has financial figures, but the file has a problem as it comes with scientific notation and of course when loading it with the File Reader Node the column type is forced into string due to the records that have the scientific notation.

See the text file

Imagen3

See the File Reader Node

Imagen

When I try to convert the columns into numbers using the String to Number node the records or columns are converted into null

Imagen2

I know that is a data problem since it’s origin, but I wonder if there is a way to aproximate such numbers into double.

Thank you

Mau

Did you tell the String to Number node to use a comma as the decimal separator?

Hi elsamuel thanks for the reply, I guess I switching one problem for another problem

Imagen4

I should consider replacing the decimal point by decimal comma

Best Regards

Mauricio

The value mentioned in the error message, where is it coming from?

I think it would be best if you provided some example data or your workflow (or both). I have no problems doing this conversion.

image

image

Hi thanks you for your help, this is a dummy data workflow

Best Regards

Mau

Scientific Notation.knwf (8.8 KB)

The String to Number node expects a single format for the decimal separator. You can’t have mixed decimal separators present.

In your original screenshot you only showed numbers with commas as the decimal separator. Now it turns out you also have numbers with a decimal point? If you had mentioned this in your first post it might have saved some time.

You’ll need to standardize your formats before the String to Number conversoin. I have no idea what your data looks like or how it’s arranged, but maybe explore using a String Manipulation node to make all your decimal separators match.

1 Like

Hi thank you, ir is definitely a data problem… the solution is to change the decimal separator.

Mau

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.