我是Python的新手,并且正在使用它来运行回归。我收到以下错误:
Error in Sys.getenv(ENV_VAR) : object 'ENV_VAR' not found
当我尝试创建包含国家/地区名称,大陆(亚洲,美洲等),人口,人均GDP和预期寿命的数据子集时。
这是我的代码:
TypeError: '>=' not supported between instances of 'list' and 'int'
我在运行最后一行后收到错误。我的pop变量(population)是一个浮点变量,但我认为#makes the variables below numeric
pop = data.groupby('pop').size()
life = data.groupby('lifeExp').size()
gdp = data.groupby('gdpPercap').size()
#create a subset within the data used here
sub1=data[(['pop']>= 100001)]
使它成为数字。任何帮助将不胜感激。
答案 0 :(得分:1)
在['pop'] >= 100001
中,您确实将列表['pop']
与int 100001
进行了比较。确保您正确引用了数据列,即data['pop'] >= 100001
答案 1 :(得分:0)
在您的比较中,您正在创建一个包含[' pop']的列表,并将其与int 100001进行比较。我猜您想将int与变量pop进行比较