Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opposite of currencytonum #660

Closed
ondohotola opened this issue Dec 16, 2022 · 3 comments · Fixed by #670
Closed

opposite of currencytonum #660

ondohotola opened this issue Dec 16, 2022 · 3 comments · Fixed by #670
Labels
enhancement New feature or request. Once marked with this label, its in the backlog.

Comments

@ondohotola
Copy link

Is your feature request related to a problem? Please describe.
Large floats (amounts like 1234567.9394) are difficult to read

Describe the solution you'd like
I would like to be able to see something like 1,234,567.94 by way of qsv apply operations enumtocurrency --round 2 or even 1,234,567.94 EUR by way of qsv apply operations enumtocurrency --round 2 --currency "EUR" and of course the thousands separator should be locale dependent, ie the Germans like 1.234.567,94

Describe alternatives you've considered
I could not find a simple way of formatting this with lua(u) and anyway, mapping only works for single columns whereas qsv apply operations currencytoenum 1- works very well.

I have no clue about Python which in any case is not compiled into the distributed versions I have

qsv 0.79.0-mimalloc-apply;fetch;foreach;generate;luau;self_update-16-16 (x86_64-unknown-linux-gnu compiled with Rust 1.66) prebuilt
qsv 0.79.0-standard-apply;fetch;foreach;generate;luau;self_update-8-8 (x86_64-apple-darwin compiled with Rust 1.66) prebuilt

Additional context
none

@jqnatividad jqnatividad added the enhancement New feature or request. Once marked with this label, its in the backlog. label Dec 16, 2022
@jqnatividad jqnatividad changed the title opposite of currencytoenum opposite of currencytonum Dec 17, 2022
@ondohotola
Copy link
Author

Thank you, I'll wait for the auto-updated version, test and report back :-)-O

I like the conversion idea.

I'll write up another little recipe in the cookbook how to get the latest exchange rates from the ECB (into a pipe)

@jqnatividad
Copy link
Owner

That'd be great @ondohotola! As a qsv power user, please do not hesitate to add recipes to the cookbook.

It sorely needs to be seeded with more content.

@ondohotola
Copy link
Author

If I do something like

printf 'currency,rate\nZAR,18.3529\n' | qsv table

I receive something like

currency  rate
ZAR       18.3529

and this

printf 'currency,rate\nZAR,18.3529\n' | qsv apply operations numtocurrency rate | qsv table

yields

currency  rate
ZAR       18.35

But the result of this

printf 'currency,rate\nZAR,18.3529\n' | qsv apply operations numtocurrency currency,rate | qsv table

is rather unexpected
.

currency  rate
0.00      18.35

In other words a non-numeric value should be unchanged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. Once marked with this label, its in the backlog.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants