Pandas DataFrame Plot boxplot graph

Pandas plot

Pandas.DataFrame.plot to generate boxplot using data

Box plot display summary of five that is minimum, first quartile, median, third quartile and maximum.
The box is drawn between first and third quartile.
Median is drawn within the box.
Let us try one example. Here we have sample data for two subjects. DataFrame boxplot
import pandas as pd 
df = pd.DataFrame(data=my_dict)

boxplot with options

There are several options we can add to above boxplot.


Default type is 'axis', we can set it to return_type='dict' , return_type='axes' or return_type='both'.


We will show grid ( grid=True ) or not ( grid=False) grid=True option grid=False option



If your source file has more columns and you want to specify the column to use.
df.boxplot(column='Open Price',figsize=(10,4),grid=True)
More than one coloumn
df.boxplot(column=['Close Price','Open Price'],grid=True)

figsize :

Size of the graph , it is a tuple saying width and height in inches, figsize=(6,3). Here width is 6 inches and height is 3 inches.


rot=45 Rotation of x axis labels in degree.
Rotation of ticks ( check the names at x axis )
rot=45 rot=180



fontsize=20 , we can set the font size used labels in x and y axis. fontsize=20

Pandas plot plot.barh()
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer