Hello to everyone.
I'm now working in Python on an exploratory data analysis (EDA) project, and I've run into an error that I'm having trouble resolving, so I read this post but couldn't figure it out. I'm hoping someone can assist me!
I'm attempting to generate a scatter plot from my dataset to visualise the association between two numerical variables, "age" and "income." The code I used is as follows:
When I execute the code, however, I receive the following error message:
I have no idea what is producing this problem or how to repair it. Could someone kindly explain what I'm doing incorrectly and walk me through the proper technique to build the scatter plot for these two variables?
Any help would be much appreciated! Thank you in advance for your assistance!
I'm now working in Python on an exploratory data analysis (EDA) project, and I've run into an error that I'm having trouble resolving, so I read this post but couldn't figure it out. I'm hoping someone can assist me!
I'm attempting to generate a scatter plot from my dataset to visualise the association between two numerical variables, "age" and "income." The code I used is as follows:
Code:
import pandas as pd
import matplotlib.pyplot as plt
# Loading the dataset
data = pd.read_csv('data.csv')
# Extracting age and income columns
age = data['age']
income = data['income']
# Creating the scatter plot
plt.scatter(age, income)
plt.xlabel('Age')
plt.ylabel('Income')
plt.title('Age vs. Income')
plt.show()
Code:
ValueError: 'income' could not be converted to float
Any help would be much appreciated! Thank you in advance for your assistance!