Take your analysis to the next level with Seaborn, a statistical visualization library for Python.
Seaborn has been around for a long time.
It is one of the most well-known and used libraries for data visualization because it is beginner-friendly and allows non-statisticians to build powerful graphics that help extract statistically-backed insights. I'm sure there is.
I'm not a statistician. My interest is in data science. You need to learn statistical concepts to perform your job better. So I like that I can easily access histograms, confidence intervals, and linear regression with very little code.
Seaborn's syntax is very basic. sns.type_of_plot(data, x, y)
. You can use that simple template to build a variety of visualizations, including: barplot
, histplot
, scatterplot
, lineplot
, boxplot
more.
But this post isn't about talking about them. Learn about other enhanced types of visualizations that can make a difference in your analysis.
Let's see what they are.
To create these visualizations and code along with this exercise, simply import seaborn using: import seaborn as sns
.
The dataset used here is student performancecreated by Paulo Cortes Contributed to the UCI Repository under a Creative Commons license. You can import it directly into Python using the code below.
# Install UCI Repo
pip install ucimlrepo# Loading a dataset
from ucimlrepo import fetch_ucirepo
# fetch dataset
student_performance = fetch_ucirepo(id=320)
# data (as pandas dataframes)
X = student_performance.data.features
y = student_performance.data.targets
# Gather X and Y for visualizations
df = pd.concat([X,y], axis=1)
df.head(3)
So let's talk about the five visualizations.
1. Strip plot
The first plot chosen is stripplot
. It's easy to see why this is interesting. Using this simple line of code, you'll see the following viz:
# Plot
sns.stripplot(data=df);