AttributeError: module 'matplotlib' has no attribute 'scatter'
AttributeError: module 'matplotlib' has no attribute 'scatter'
我正在尝试创建纬度和经度的集群。
该代码在 plt.scatter(data['Lng'],data['Lat'])
行
中出错
错误是:
AttributeError: module 'matplotlib' has no attribute 'scatter'
代码:
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
应该是:
import matplotlib.pyplot as plt
或者可以是:
from matplotlib import pyplot as plt
您还可以阅读 PEP 328 以获得更多信息和清晰度。
我正在尝试创建纬度和经度的集群。
该代码在 plt.scatter(data['Lng'],data['Lat'])
行
错误是:
AttributeError: module 'matplotlib' has no attribute 'scatter'
代码:
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
应该是:
import matplotlib.pyplot as plt
或者可以是:
from matplotlib import pyplot as plt
您还可以阅读 PEP 328 以获得更多信息和清晰度。