picture of csv file containing raw data I am trying to plot a scatter graph using an online csv file i downloaded in inorder to get the linear regression.
%matplotlib inline plt.scatter(df.year, df.income(US), color='red', marker='+')
Error message reads: AttributeError: 'DataFrame' object has no attribute 'year'
year
is an index, so you can get it like that:
plt.scatter(df.index, df["income(US)"], color='red', marker='+')
Also you will get an error AttributeError: 'DataFrame' object has no attribute 'income'
if you try to get income value like this df.income(US)
. This is only allowed if the name of the column does not contain special symbols. df["income(US)"]
is correct.