我认为这是一个缩进错误,但对于我的生活,我无法弄清楚我哪里出错了。希望得到一些帮助
def read_csv(filename):
with open(filename) as f:
reader = csv.reader(f)
next(reader)
rain = []
highest_correlated = []
for row in reader:
rain.append(float(row[1]))
highest_correlated.append(float(row[2]))
return rain, highest_correlated
import matplotlib.pyplot as plt
import csv
if __name__ == '__main__':
rain, highest_correlated = read_csv('correlaterain.csv')
corr = find_corr_x_y(rain, highest_correlated)
print('Highest correlation: {0}'.format(corr))
scatter_plot(rain, highest_correlated)