-
Notifications
You must be signed in to change notification settings - Fork 13
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
Added percent functions. #130
base: master
Are you sure you want to change the base?
Conversation
We can also replace |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #130 +/- ##
===========================================
- Coverage 97.40% 81.45% -15.95%
===========================================
Files 13 14 +1
Lines 424 507 +83
===========================================
Hits 413 413
- Misses 11 94 +83 ☔ View full report in Codecov by Sentry. |
I also noticed a small bug where |
I also like the idea of users being able to create percent vectors using numbers representing literal percentages. |
I like this idea too. Also prompted the thought that we should have a check (maybe producing a warning), so if someone provides 'numbers that look like percentages' e.g. |
I'm a bit apprehensive about this because in general percentages above 100% are completely acceptable depending on the context. For example, in finance, percentage increases above 100% are very normal. |
Light touch checks 😄 |
I agree in principle that you can certainly have 'incorrect' percentages though I think the need to check for those is probably quite niche and maybe needs a bit of justification. I would be inclined to go with a 'less-is-more' approach and see how users interact with this new percent object before including checks and warnings that might make things confusing. In practice we could let the user decide that the function checks for percentages greater than a specified cut-off where the default value is say |
I have an idea for how to deal with formatting digits greater than the default 2 decimal places without having to go through For example let's say the user wants their percent vector to be formatted to 4 decimal places. Furthermore, we can code it so that if a user later decides they want a different number of decimal places, they can use |
Good idea. The add here is to allow the user to set a 'default' at the moment it's 2 (per the style guide). You can print different digits with |
Added percent function and related methods as discussed.
I'm unsure about what the default digits should be set as so I just set them to 2. Maybe we could create an option the user could set for all formatting methods.