python-ballpark icon indicating copy to clipboard operation
python-ballpark copied to clipboard

Better human-readable numbers

Results 14 python-ballpark issues
Sort by recently updated
recently updated
newest added

The following call now fails systematically with Python 3.10: `ballpark.business(123)` with the error: ``` File /usr/local/Caskroom/miniconda/base/envs/myenv/lib/python3.10/site-packages/ballpark/utils.py:85, in unwrap..unwrapped_function(values, *vargs, **kwargs) 83 @functools.wraps(fn) 84 def unwrapped_function(values, *vargs, **kwargs): ---> 85 scalar...

The tests are located within the module [ballpark.tests](https://github.com/debrouwere/python-ballpark/blob/0b871cdf5b4b5f50e5f3f3d044558801783381c4/ballpark/tests.py). It is a common convention to place tests outside the package, usually in a directory `tests`. They can still be distributed with...

Fixes #4. Installing Pandas on a raspberry pi is very very slow, we dont need to load Pandas just to use Ballpark

Hi there, I've just been using this package with some financial stats and noticed it didn't handle negative inputs, so added a simple handler in the ```unwrap``` function. Feedback welcome!

```bash in () ----> 1 from ballpark import H, S, E, B ImportError: cannot import name 'H' ```

`'$'+ballpark.business(100000)` > Out[23]: '$100K' `'$'+ballpark.business(-100000)` > Traceback (most recent call last): > File "C:\Python\Python36\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code > exec(code_obj, self.user_global_ns, self.user_ns) > File "", line 1, in > '$'+ballpark.business(-100000)...

The actual SI prefix for kilo is 'k', not 'K' ([Wikipedia](https://en.wikipedia.org/wiki/Metric_prefix)). I'd be happy to submit a pull request if this could be agreed upon. If the K would have...

Quantize to somewhere in between a magnitude. For example: * `ceil(55.25, 1.2) => 55.26` * `floor(55.25, 1.2) => 55.24` * `round(55.3333, 2.5) => 55.335` * `round(12.345, 1.1) == round(12.345, 2)...

enhancement

When rounding, optionally ensure that `sum(round(values)) == round(sum(values))` by rounding some numbers in the opposite direction than the one dictated by convention. The rounding error should be minimized, e.g. prefer...

enhancement

```python import ballpark >>> ballpark.ballpark(0) '' ``` This result is unexpected. When inserted in a message string, it leaves a blank where a number was supposed to appear.