Error in numeric utils
See original GitHub issueDescribe the bug
(Line 191 in numeric utils)[https://github.com/arviz-devs/arviz/blob/c5edec458316501b6a9b22a718e09aa06c7fd0ff/arviz/numeric_utils.py#L191] is as follows:
width = np.round(np.max([1, bins_sturges, bins_fd])).astype(int)
When I ran this as part of running the PyMC3 getting started notebook,
round(np.max([1, bins_sturges, bins_fd]))
evaluated to 1, and, apparently 1.astype(int)
raises an AttributeError
:
AttributeError: 'int' object has no attribute 'astype'
I don’t, unfortunately, know how to reproduce this: when I set values for these variables and run the code outside ArviZ and PyMC3, it works fine. This works:
import numpy as np
bins_sturges = 1.2598237927692393
bins_fd = 0.27849533001676674
width = np.round(np.max([1, bins_sturges, bins_fd])).astype(int)
Is there, perhaps, some state of numpy or the python interpreter that is set and causes this to break? It seems like somehow the value of the np.round()
expression ends up being a python-native int, instead of a numpy value, but I don’t know how this could happen.
Additional context
arviz 0.8.3 pandas 1.0.5 numpy 1.19.0 pymc3 3.9.2 last updated: Sun Jul 12 2020
CPython 3.7.7 IPython 7.16.1 watermark 2.0.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
… but it does happen to me every time I try to run the notebook.
BTW I tried to reproduce it, running the notebook with two numpy versions. no luck.