[英]How to get specific values in from a pandas data frame using python?
I'm trying to run the script below:我正在尝试运行以下脚本:
g20s = ['Argentina, Australia, Brazil, Canada, China, France, Germany, India, Indonesia, Italy, Japan, Mexico, Republic of Korea, Russia, Saudi Arabia, South Africa, Turkey, United Kingdom, United States, European Union']
gdp_g20 = gdp_world.loc(gdp_world['Country Name'].isin(g20s))
But I'm gettin the error below:但我遇到了以下错误:
TypeError: 'Series' objects are mutable, thus they cannot be hashed TypeError:“系列”对象是可变的,因此它们不能被散列
Any idea of how get these values from the dataframe without having this problem?知道如何从 dataframe 获得这些值而不会出现此问题吗?
Thanks a lot!非常感谢!
Your problem is the "(" and ")"你的问题是“(”和“)”
Try this: gdp_g20 = gdp_world[gdp_world['Country Name'].isin(g20s)]试试这个:gdp_g20 = gdp_world[gdp_world['Country Name'].isin(g20s)]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.