def calc_mode (df, nazwa_polutwa)
### START FUNCTION
def calc_mean_mode(df, column_name):
numeric = df.select_dtypes(include=['int64', 'float64']).columns
non_numeric = df.select_dtypes(include=['object']).columns
if column_name in numeric:
return round(np.mean(df[column_name]), 2)
elif column_name in non_numeric:
return sorted(list(df[column_name].value_counts().index[df[column_name].value_counts() == df[column_name].value_counts().max()]))
else:
raise ValueError
### END FUNCTION
Abayomi Briggs