Learn Before
Code
Matplotlib Scatter Plot
Using this dataframe,
df = pd.DataFrame({ 'name':['john','mary','peter','jeff','bill','lisa','jose'], 'age':[23,78,22,19,45,33,20], 'gender':['M','F','M','M','M','F','M'], 'state':['california','dc','california','dc','california','texas','texas'], 'num_children':[2,0,0,3,2,1,4], 'num_pets':[5,1,0,5,2,2,3] })
To create a scatterplot of two columns,
df.plot(kind='scatter',x='num_children',y='num_pets',color='red') plt.show()

0
1
Updated 2021-07-29
Tags
Python Programming Language
Data Science