Python XY-Scatter Plot with Linear Regression: Demos the numpy, matplotlib, and csv modules

Publicado el: 01 June 2023
en el canal de: Thomas Blum
480
5

In this video we look at a Python program the reads some x-y data from a csv file. The x's are the speed (in kilometers per hour) at which someone performs an exercise, and the y's are the heart rate (in beats per minute). The program uses the x and y lists and matplotlib's scatter method to make an xy-scatter plot. Next it uses numpy's polyfit method to perform a linear regression (aka create a linear model, aka perform a least-squares fit) of the data. The method yields the best-fit slope and intercept. The program uses numpy's linspace to generate a sequence of x values, and those are in turn used to plot the fit line. Finally the program creates a display version of the best fit line and uses the matplotlib's text() method to add it to the displayed data and fit line.


En esta página del sitio puede ver el video en línea Python XY-Scatter Plot with Linear Regression: Demos the numpy, matplotlib, and csv modules de Duración hora minuto segunda en buena calidad , que subió el usuario Thomas Blum 01 June 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 480 veces y le gustó 5 a los espectadores. Disfruta viendo!