0

I try to create a histogram according to specified bins. Can not understand why the operation is taking up a very long time (almost more than 15 minutes) to execute? I went through the documentation of the functions involved but could not seem to find the reason behind it. I have an i3 5th Gen processor and 8 GB of RAM just in case this information is needed.

Here are details of the data involved

df.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 50 entries, 0 to 49
Data columns (total 4 columns):
State           50 non-null object
Population      50 non-null int64
Murder.Rate     50 non-null float64
Abbreviation    50 non-null object
dtypes: float64(1), int64(1), object(2)
memory usage: 1.7+ KB
df.describe()
       Population   Murder.Rate
count   5.000000e+01    50.000000
mean    6.162876e+06    4.066000
std 6.848235e+06    1.915736
min 5.636260e+05    0.900000
25% 1.833004e+06    2.425000
50% 4.436370e+06    4.000000
75% 6.680312e+06    5.550000
max 3.725396e+07    10.300000

And the operation

df["Population"].hist(bins = np.arange(df["Population"].min(), df["Population"].max(), step=11))

0 Answers0