Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'matplotlib' has no attribute 'scatter'

I'm trying to make cluster of latitude and longitude. the code gave an error in plt.scatter(data['Lng'],data['Lat']) line

the error is:

AttributeError: module 'matplotlib' has no attribute 'scatter' 

code:

import numpy as np
import pandas as pd
import matplotlib as plt
import seaborn as sns
sns.set()
from sklearn.cluster import KMeans
data = pd.read_csv("pk.csv") 
data.head()
lat_long = data.drop(['country', 'iso2','admin', 'capital','population', 
'population_proper'] , axis = 1)
lat_long.head()
plt.scatter(data['Lng'],data['Lat']) # error here
like image 626
Osama Billah Avatar asked Nov 29 '22 08:11

Osama Billah


1 Answers

It should be:

import matplotlib.pyplot as plt
like image 116
Franco Piccolo Avatar answered Jan 18 '23 12:01

Franco Piccolo