This is a follow-up to this question: Pandas limit Series/DataFrame to range of values of one column
I'd next like to histogram the numbers in the "Age" column and then smooth the result (to reduce scatter). What's an elegant way to do this?
This is a follow-up to this question: Pandas limit Series/DataFrame to range of values of one column
I'd next like to histogram the numbers in the "Age" column and then smooth the result (to reduce scatter). What's an elegant way to do this?
You can use Seaborn and its function distplot which plot by default a kernel density estimate and histogram with bin size determined automatically.
import seaborn as sns
import numpy as np
import pandas as pd
# Some test data
np.random.seed(33454)
df = pd.DataFrame({'nb': np.random.randint(0, 1000, 100)})
df.sort_values('nb', inplace=True)
ax = sns.distplot(df['nb'])