You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a CSV with floating point numbers in it, and it would be great to limit them to ~3 signif digits -- here's what it looks like currently. I can't find a flag to do that tho!
round float to n decimal places
Usage:
csvtk round [flags]
Flags:
-a, --all-fields all fields, overides -f/--fields
-n, --decimal-width int limit floats to N decimal points (default 2)
-f, --fields string select only these fields. e.g -f 1,2 or -f columnA,columnB (default "1")
-F, --fuzzy-fields using fuzzy fields, e.g., -F -f "*name" or -F -f "id123*"
-h, --help help for round
Examples:
$ cat testdata/floats.csv | csvtk pretty
a b
0.12345 abc
NA 0.9999198549640733
12.3 e3
1.4814505299984235e-05 -3.1415926E05
# one or more fields
$ cat testdata/floats.csv | csvtk round -n 2 -f b | csvtk pretty
a b
0.12345 abc
NA 1.00
12.3 e3
1.4814505299984235e-05 -3.14E05
# all fields
$ cat testdata/floats.csv | csvtk round -n 2 -a | csvtk pretty
a b
0.12 abc
NA 1.00
12.30 e3
1.48e-05 -3.14E05
Prerequisites
csvtk version
Describe your issue
I have a CSV with floating point numbers in it, and it would be great to limit them to ~3 signif digits -- here's what it looks like currently. I can't find a flag to do that tho!
The text was updated successfully, but these errors were encountered: