Snippets Collections
# Get the Numerical Data list to infer distribution plots

numerical = [var for var in df.columns if df[var].dtype!='O'] 
print('There are {} numerical variables\n'.format(len(numerical))) 
print('The numerical variables are :', numerical)

# Get the Categorical Data list to infer distribution plots

categorical = [var for var in df.columns if df[var].dtype =='O'] 
print('There are {} Categorical variables\n'.format(len(categorical))) 
print('The Categorical variables are :', categorical)
# Discretization
df3["Total_Amt_Chng_Q4_Q1_qcut"]=pd.qcut(df3["Total_Amt_Chng_Q4_Q1"],4)
df3["Total_Trans_Amt_qcut"]=pd.qcut(df3["Total_Trans_Amt"],4)
df3["Total_Ct_Chng_Q4_Q1_qcut"]=pd.qcut(df3["Total_Ct_Chng_Q4_Q1"],4)
# Split the dataset 2 parts that categorical and numerical

cat_col=list(df1.select_dtypes(include="object").columns)
num_col=list(df1.select_dtypes(exclude="object").columns)
print("Categorical Features:",cat_col,sep="\n\n")
print("")
print("Numerical Features:",num_col,sep="\n\n")

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension