- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot two columns of a Pandas data frame using points?
First, we can initialize the dictionary with col1 and col2, convert it into a data frame. After that, we can plot this data with ‘o’ and ‘rx’ style.
Steps
Create a dictionary with Column 1 and Column 2 as the keys and Values are like i and i*i, where i is from 0 to 10, respectively.
Create a data frame using pd.DataFrame(d); d created in step 1.
Plot the data frame with ‘o’ and ‘rx’ style.
To show the plot, use plt.show().
Example
import pandas as pd from matplotlib import pyplot as plt d = {'Column 1': [i for i in range(10)], 'Column 2': [i*i for i in range(10)]} df = pd.DataFrame(d) df.plot(style=['o', 'rx']) plt.show()
Output
- Related Articles
- How to display the values of two columns of an R data frame separately in a plot?
- Python Pandas - Plot multiple data columns in a DataFrame?
- Plot multiple columns of Pandas DataFrame using Seaborn
- How to convert two columns of an R data frame to a named vector?
- How to extract columns of a data frame in R using dplyr package?
- How to create scatterplot using data frame columns in R?
- How to create table of two factor columns in an R data frame?
- How to plot arbitrary markers on a Pandas data series using Matplotlib?
- How to create bar plot using ggplot2 with structure data frame?
- How to find the cumulative sums by using two factor columns in an R data frame?
- How to create scatterplot by standardizing the columns of a data frame using ggplot2 R?
- How to apply a manually created function to two columns in an R data frame?
- How to plot CSV data using Matplotlib and Pandas in Python?
- How to add a prefix to columns of an R data frame?
- How to drop data frame columns in R by using column name?

Advertisements