I have a list of real numbers type float64
which I use them to plot their histogram. When I read my data file, I use this function:
def read1col(filename):
data = []
for line in open(filename,'r'):
for word in line.split():
data.append(word)
data = np.asarray(data, dtype=np.longdouble)
return data
If I use the function plt.hist(data, bins=100)
, matplotlib returns me the error:
The first argument of bincount must be non-negative
However, I want to say that it is an obscure error for the following reason: I have 60,000 numbers in the file to do the histogram. If I do plt.hist(data[:1000], bins=100)
I obtain the histogram without problem. If I include more elements, then the error is raised up.
I use anaconda, also I just downloaded and re-installed it the past week.