
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python Pandas - Draw a boxplot for each numeric variable in a DataFrame with Seaborn
Box Plot in Seaborn is used to draw a box plot to show distributions with respect to categories. The seaborn.boxplot() is used for this. Use the "orient” parameter for orientation of each numeric variable.
Let’s say the following is our dataset in the form of a CSV file − Cricketers.csv
At first, import the required libraries −
import seaborn as sb import pandas as pd import matplotlib.pyplot as plt
Load data from a CSV file into a Pandas DataFrame −
dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv")
Plotting box plot using the orient parameter for orientation of each numeric variable −
sb.boxplot( data = dataFrame, orient="h")
Example
Following is the code −
import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # Load data from a CSV file into a Pandas DataFrame: dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") # plotting box plot # using the orient parameter for orientation of each numeric variable sb.boxplot( data = dataFrame, orient="h") # display plt.show()
Output
This will produce the following output −
- Related Articles
- Python Pandas - Draw a vertical boxplot grouped by a categorical variable with Seaborn
- Python Pandas - Draw a vertical violinplot grouped by a categorical variable with Seaborn
- Python Pandas - Draw a boxplot and control box order by passing an explicit order with Seaborn
- Python Pandas - Draw a set of vertical bar plots grouped by a categorical variable with Seaborn
- Python Pandas - Draw a set of vertical point plots grouped by a categorical variable with Seaborn
- Python - Draw a Scatter Plot for a Pandas DataFrame
- Python Pandas - Draw a single horizontal violinplot with Seaborn
- Python Pandas - Draw a boxplot and display the datapoints on top of boxes by plotting Swarm plot with Seaborn
- Python Pandas - Group the swarms by a categorical variable with Seaborn
- Draw a lineplot passing the entire dataset with Seaborn – Python Pandas
- Python Pandas - Draw a set of horizontal bar plots with Seaborn
- Python Pandas - Draw a set of Horizontal point plots with Seaborn
- Python - Search DataFrame for a specific value with pandas
- Python - Plot a Histogram for Pandas Dataframe with Matplotlib?
- Correlation between two numeric columns in a Pandas DataFrame

Advertisements