How to plot a series in pandas
Python can be used to manipulate and analyze data using the pandas library. It will help us in visualizing the results our data analysis yields.
To visualize a single series of data with the help of plot, we use the pd.Series() function. It will help us visualize a single series of data using different plots.
Syntax
df.Series({'%%Series%%'})gfg.plot(kind = '%%Plot type%%')
To use the series, we first define the Series using the built-in function. Then we define the kind of plot we want to use for our visualization in the plot function.
Example
Let's look at an example.
import pandas as pdimport matplotlib.pyplot as plt# using Series.plot() methodseries = pd.Series([1.5,2.4,3.16, 4.32,5.9,6.81,7.2,4.5,5.6])series.plot(kind='pie')plt.show()
Explanation
Line 5: Pass the series of numbers as values to the
Series()function.Line 7: Define the type of plot we want to use for the visualization.
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved