# 基于numpy用于数据分析的库
import pandas
import numpy as np
import matplotlib.pyplot as plt
pga = pandas.read_csv('pga.csv')
# std()计算标准差
pga.distance = (pga.distance - pga.distance.mean()) / pga.distance.std()
pga.accuracy = (pga.accuracy - pga.accuracy.mean()) / pga.accuracy.std()
# 读取前五行数据
print(pga.head())
print(type(pga))
# 散点图
plt.scatter(pga.distance, pga.accuracy)
plt.xlabel('normalized distance')
plt.ylabel('normalized accuracy')
plt.show()
结果如下:
散点图
网友评论