Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

How to resolve Python Error: "The first argument of bincount must be non-negative"

$
0
0

@Aarshay wrote:

Hi,

I'm trying to create a histogram in python after taking a log transformation using the following code:

coltr = np.log(col)
skew = coltr.skew()
kurt = coltr.kurt()
title = "Histogram | Skew = %f | Kurt = %f"%(np.round(skew,2),np.round(kurt,2))
plt.figure()
plt.hist(coltr, bins=20)  
plt.ylabel("Frequency")
plt.xlabel(col.name)
plt.title(title)
plt.show(block=False)

Here "col" is a pandas series object which has to be transformed and plotted. This code results in an error:
ValueError: The first argument of bincount must be non-negative

I'm unable to figure out a solution. How can the bincount be negative?

Thanks,
Aarshay

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles