Solution To Task 1
Solution To Task 1
import pandas as pd
import numpy as np
data = {
df = pd.DataFrame(data)
plt.scatter(years_exp, salaries)
plt.xlabel('Years of Experience')
plt.grid(True)
plt.show()
# Creating and fitting the linear regression model
model = LinearRegression()
model.fit(years_exp, salaries)
predicted_salary = model.predict([[6]])
print("Predicted salary for an employee with 6 years of experience (in 1000s):", predicted_salary[0])
plt.scatter(years_exp, salaries)
plt.xlabel('Years of Experience')
plt.grid(True)
plt.show()