AttributeError: module 'numpy' has no attribute 'histogram_bin_edges'
时间: 2023-09-21 20:11:21 浏览: 174
This error occurs when trying to use the function `histogram_bin_edges` from the `numpy` module, but it is not found.
This function was introduced in NumPy version 1.17.0, so it is possible that you are using an older version of NumPy that does not have this function.
To resolve this error, you can try updating your version of NumPy to the latest version, or you can use an alternative method for computing histogram bin edges. One alternative is to use `numpy.histogram` to compute the histogram and then use the `bins` output to get the bin edges. For example:
```
import numpy as np
data = np.random.normal(size=1000)
hist, bin_edges = np.histogram(data, bins='auto')
```
This will compute a histogram of the `data` array using the 'auto' algorithm for choosing the number of bins, and return the histogram counts in `hist` and the corresponding bin edges in `bin_edges`.
阅读全文