Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Created July 15, 2019 00:08
Show Gist options
  • Save kperry2215/a539ef55fca70d9676d50b692ef32cc3 to your computer and use it in GitHub Desktop.
Save kperry2215/a539ef55fca70d9676d50b692ef32cc3 to your computer and use it in GitHub Desktop.
def generate_boxplot(df, x_variable):
"""
This function generates a basic histogram of a column's data, with
outliers removed
Arguments:
df: Pandas dataframe
x_variable: String. Name of the column that we want to generate
boxplot from
Outputs:
Box plot in console.
"""
plt.boxplot(list(df[x_variable].dropna()), showfliers=False)
plt.show()
...
#Execution in main script
generate_boxplot(dataframe, x_variable='TotalBaseNonWaterVolume')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment