Home > Software design >  Problem with the following error: Name " " is not defined
Problem with the following error: Name " " is not defined

Time:06-08

I am trying to do a scatter plot but I obtain the following error: "x and y must be the same size". Then, I check the size of the variables to see from where the problem comes.

However, when I do that, it seems that one of the variables (variable "pop") does not exist when it should exist.

I attach a picture of the problem:

enter image description here

Any idea of why this is happening?

CodePudding user response:

You haven't defined a variable named pop, so you can't refer to it. If it's a column of your DataFrame, you can refer to it as city_join['pop']

CodePudding user response:

Instead of writing pop.shape you can just write city_join["pop"].shape.

  • Related