Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pandas as pd
- df = pd.read_csv('weight-height.csv')
- x = np.array(df['Height'])
- y = np.array(df['Weight'])
- a = (np.mean(x * y) - np.mean(x) * np.mean(y)) / (np.mean(x ** 2) - np.mean(x)**2)
- b = np.mean(y) - a * np.mean(x)
- print(a, b)
Add Comment
Please, Sign In to add comment