MonkeyDLuffy
MonkeyDLuffy

Reputation: 558

Cannot get the appropriate histogram

I'm working on credit card data available on Kaggle. I want to plot the histogram for a column named 'Amount' from the data file named 'credit'. I want the plot for all the range of Amount but I ain't getting it. The range of Amount is [0,25691.16]. But the range showing in the plot is max_value/(num_bins). What should be the change in the code required to get plot over the total range mentioned above?

In the example code mentioned below the plot is showing a single bar of width 2569.116 (range/num_bins). What I need is 10 bars covering the entire range

plt.hist(credit['Amount'],10,density=True,range=(0,25691.16) ,facecolor='red',alpha=0.5)

Upvotes: 2

Views: 63

Answers (1)

Mohsen Abedin Nejad
Mohsen Abedin Nejad

Reputation: 81

your code is right. I think it is the nature of your data that you cannot see the other bars since the density in the first bin is very high. In other words, almost all 'Amount' are in (0, 2569.116) and there are a few 'Amount' that are in the intervals (2569.116, 5138.232), ... , (23122.044, 25691.16).

Upvotes: 1

Related Questions