Jul-01-2018, 08:11 AM
Hi Everyone,
I'm trying to understand the below code. My question is why is it returning salary_bins?
So from what I understand it first defines the table columns, creates the bins and then draws the histograms.
But the return part I'm not sure I fully understand. I tried to run it with return salary_bins and it created the histograms as well.
Thanks in advance.
I'm trying to understand the below code. My question is why is it returning salary_bins?
So from what I understand it first defines the table columns, creates the bins and then draws the histograms.
But the return part I'm not sure I fully understand. I tried to run it with return salary_bins and it created the histograms as well.
Thanks in advance.
def histograms(t): ages = t.column('Age') salaries = t.column('Salary') age_bins = np.arange(min(ages),max(ages)+1,1) salary_bins = np.arange(min(salaries), max(salaries)+1000000,1000000) t.hist('Age', bins=age_bins, unit='year') t.hist('Salary', bins=salary_bins, unit='$') return age_bins # Keep this statement so that your work can be checked histograms(full_data) print('Two histograms should be displayed below')