# Import NumPy and matplotlib.pyplot
import numpy as np
import matplotlib.pyplot as plt
# Read in the data for age, bmi and insurance charges in separate arrays.
# Print out to check
#
age = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=0) # input column 1 with index 0
print('Age Data')
print (age)
#
bmi = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=2) # input column 1 with index 0
print('BMI Data')
print (bmi)
#
insurance = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=6) # input column 1 with index 0
print('Insurance Costs')
print (insurance)
# print out the number of data instances
print(f"We have {len(age)} data entries")
print(f"We have {len(bmi)} data entries")
print(f"We have {len(insurance)} data entries")
# plot charges vs age and add labels to axis and title
insurance = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=6) # input column 1 with index 0
print('Insurance Costs')
print (insurance)
age = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=0) # input column 1 with index 0
print('Age Data')
print (age)
x = np.array (age)
y= np.array(insurance)
plt.scatter (x,y)
plt.title('Charges vs Age plot')
plt.xlabel('age')
plt.ylabel('charges')
plt.plot (x, y, 'ro')
# plot charges vs BMI; add axis labels and plot title
insurance = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=6) # input column 1 with index 0
print('Insurance Costs')
print (insurance)
bmi = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=2) # input column 1 with index 0
print('BMI Data')
print (bmi)
x = np.array (bmi)
y= np.array(insurance)
plt.scatter (x,y)
plt.title('bmi vs charges')
plt.xlabel('bmi')
plt.ylabel('charges')
plt.plot (x, y, 'ro')
# Import NumPy and matplotlib.pyplot
import numpy as np
import matplotlib.pyplot as plt
# Read in the data for bmi and insurance charges in separate arrays.
# Print out to check
#
filename='insurance.csv'
insurance = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=6) # input column 1 with index 0
print('Insurance Costs')
print (insurance)
bmi = np.loadtxt('insurance.csv', delimiter=',', skiprows=1, usecols=2) # input column 1 with index 0
print('BMI Data')
print (bmi)
# Fit a line using linear regression
# Plot data and line on same graph
# Fit a parabola to data
# Plot data and parabola on same graph