working with decimals numbers

352 views
Skip to first unread message

Adilson Gonçalves

unread,
Jul 28, 2022, 8:37:23 AM7/28/22
to OpenRefine
hello community, i´m a beginner in openrefine, i need your help pls.
i have a column with very long decimal numbers, i need to remove some decimal digits. can you help me solve this?

thank you in advance!

Owen Stephens

unread,
Jul 28, 2022, 10:16:35 AM7/28/22
to OpenRefine
It may depend on your exact requirements, but one way to approach this is to make sure the numbers you have are stored by OpenRefine as a number - they would display as green in the UI and a Numeric Facet on the column would successfully display the data.

If you currently have the information as Strings rather than Numbers you can do a transformation like:
value.toNumber()

Once you have the data as numbers, then you can covert back to a string with a particular number of decimal places (with rounding) using a transformation like:
value.toString("%.4f")

This would round to 4 decimal places. Change the '4' in this transformation to another number to round to a different number of decimal places

Owen

Thad Guidry

unread,
Jul 28, 2022, 10:36:21 AM7/28/22
to openr...@googlegroups.com
Besides using GREL syntax, if you have a simple text or number conversion then those can be done with common transforms we have under the dropdown menus on each column.



--
You received this message because you are subscribed to the Google Groups "OpenRefine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrefine+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openrefine/6e023503-7afe-4740-881e-723c77177d75n%40googlegroups.com.

Adilson Pina Gonçalves

unread,
Jul 28, 2022, 12:28:36 PM7/28/22
to openr...@googlegroups.com
I followed your tips and it worked perfectly and the results are great.
Thank you very much.

--
You received this message because you are subscribed to a topic in the Google Groups "OpenRefine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openrefine/nkYVEAtz1sA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openrefine+...@googlegroups.com.


--
Adilson Gonçalves

Geógrafo e Coordenador do Projeto CEPF - 108479 - Associação Projecto Vitó

Contactos:
Tel: +238 993 12 06 -- 9172741
Email alternativo: adylso...@hotmail.com



Reply all
Reply to author
Forward
0 new messages