Table of Contents
ToggleExperiment and learn with our interactive “Try it Yourself” editor. Edit Python code and instantly view the results!
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
full_health_data = pd.read_csv("data.csv", header=0, sep=",")
x = full_health_data["Average_Pulse"]
y = full_health_data["Calorie_Burnage"]
slope, intercept, r, p, std_err = stats.linregress(x, y)
def myfunc(x):
return slope * x + intercept
mymodel = list(map(myfunc, x))
plt.scatter(x, y)
plt.plot(x, mymodel)
plt.ylim(ymin=0, ymax=2000)
plt.xlim(xmin=0, xmax=200)
plt.xlabel("Average_Pulse")
plt.ylabel("Calorie_Burnage")
plt.show()
Click on the “Try it Yourself” button to explore how it works.
Python is a powerful and versatile programming language widely used in Data Science. With built-in mathematical libraries and functions, Python makes solving complex mathematical problems and performing data analysis straightforward.
In this tutorial, we’ll use Python to provide hands-on examples and practical knowledge for beginners.
