bramp / bramp/handy-tools

hist.py fails if it only receives the same number

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

``` shell
echo "2.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045" | hist.py
```

outputs

```
Traceback (most recent call last):
File "/Users/bramp/bin/hist.py", line 151, in
main()
File "/Users/bramp/bin/hist.py", line 133, in main
hist = hist_fd(raw)
File "/Users/bramp/vendor/handy-tools/_hist.py", line 57, in hist_fd
return hist_dict(data, N = int(r / (2*iqr / math.pow(n, 1/3))))
ZeroDivisionError: float division by zero
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the shell command from the issue, then inspect hist.py around main and vendor/handy-tools/_hist.py around hist_fd, the locations shown in the traceback. Confirm the behavior with repeated identical values and consider the task complete when the command finishes without the ZeroDivisionError and produces histogram output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.