ComeçarComece de graça

Visualizing survey data

Following up on the previous exercise on survey data among European IT specialists, visualize the linear relationship between experience_years and current_salary, to give a rough estimate of what different levels of experiences are earning.

The data has been loaded for you as data, along with pandas, Matplotlib.pyplot, and NumPy, as pd, plt, and np, respectively.

Este exercício faz parte do curso

Analyzing Survey Data in Python

Ver curso

Instruções do exercício

  • Plot the original values using a scatter plot.
  • Get the range of data.
  • Get the range of values for plotting the regression line.
  • Plot the regression line.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Plot the original values using a scatter plot
x = data.____
y = data.____
____.____(x,y)

# Get the range of data
max_x = ____
min_x = ____

# Get the range of values
x = ____.____(min_x,max_x,1)
y = 1590.4569 * x + 58080

# Plot the regression line
____.____(x, y,'r')
plt.show()
Editar e executar o código