Python / Data Science Essentials Interview Questions
What are the most important Seaborn plot types for exploratory data analysis?
Seaborn divides its plots into relational (relationship between variables), distributional (distribution of a single variable), and categorical (comparison across categories). Knowing when to use each makes EDA far more efficient.
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset('tips')
# --- Relational ---
# Scatter with colour encoding
sns.scatterplot(data=tips, x='total_bill', y='tip',
hue='smoker', size='size', palette='Set1')
# Regression line + scatter
sns.regplot(data=tips, x='total_bill', y='tip', ci=95)
# --- Distributional ---
# Histogram + KDE
sns.histplot(data=tips, x='total_bill', hue='sex', kde=True, bins=20)
# KDE only
sns.kdeplot(data=tips, x='total_bill', hue='sex', fill=True)
# ECDF — empirical cumulative distribution
sns.ecdfplot(data=tips, x='total_bill', hue='day')
# --- Categorical ---
# Box plot
sns.boxplot(data=tips, x='day', y='total_bill', hue='smoker', palette='pastel')
# Violin — box + KDE combined
sns.violinplot(data=tips, x='day', y='tip', inner='quartile')
# Bar chart with error bars (95% CI by default)
sns.barplot(data=tips, x='day', y='tip', estimator='mean', errorbar='ci')
# Strip plot — all individual points
sns.stripplot(data=tips, x='day', y='tip', jitter=True, alpha=0.4)
# --- Multi-variable overview ---
# Pair plot — scatter matrix of all numeric column pairs
sns.pairplot(tips, hue='sex', diag_kind='kde')
# Heatmap — great for correlation matrices
corr = tips.select_dtypes('number').corr()
sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm', vmin=-1, vmax=1)
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
