Skip to content

Instantly share code, notes, and snippets.

@evu
Created August 13, 2019 20:04
Show Gist options
  • Save evu/d53a819914e238bf21ca825361e83573 to your computer and use it in GitHub Desktop.
Save evu/d53a819914e238bf21ca825361e83573 to your computer and use it in GitHub Desktop.
My Fav Pandas ๐Ÿผ
# Summary statistics for numeric variables
df.describe().transpose()
# Summary statistics for categorical/string variables
df.describe(include=['O']).transpose()
# Info about column names, datatypes, and null values
df.info()
# Get a sample
df.sample(10)
df.username.sample(10)
# Frequency counts for categorical variable
df.state.value_counts()
# Count missing values for all columns / a specific column
df.isnull().sum()
df.state.isnull().sum()
# Get value at given quantile
df.upvotes.quantile(0.99)
# Correlation coefficient
df.awards.corr(df.upvotes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment