嗨,我正在学习数据科学,正在制作一个大数据公司列表,其中包含一些属性。你知道吗
目前我的数据帧,data,看起来像这样。你知道吗
company_url company tag_line product data
0 https://angel.co/billguard BillGuard The fastest smartest way to track your spendin... BillGuard is a personal finance security app t... New York City · Financial Services · Security ...
1 https://angel.co/tradesparq Tradesparq The world's largest social network for global ... Tradesparq is Alibaba.com meets LinkedIn. Trad... Shanghai · B2B · Marketplaces · Big Data · Soc...
2 https://angel.co/sidewalk Sidewalk Hoovers (D&B) for the social era Sidewalk helps companies close more sales to s... New York City · Lead Generation · Big Data · S...
3 https://angel.co/pangia Pangia The Internet of Things Platform: Big data mana... We collect and manage data from sensors embedd... San Francisco · SaaS · Clean Technology · Big ...
4 https://angel.co/thinknum Thinknum Financial Data Analysis Thinknum is a powerful web platform to value c... New York City · Enterprise Software · Financia...
我想用某些关键字(比如“bigdata”)对“data”列进行排序,并用这些行创建一个新的dataframe。你知道吗
我想先找到合适的行,然后,把它们放到一个列表中,然后根据行列表对数据框、数据进行排序,但是第一部分出现了一个错误。你知道吗
我的代码:
comp_rows = []
a = ['Data','Analytics','Machine Learning','Deep','Mining']
for count, item in enumerate(data.data):
if any(x in item for x in a):
comp_rows.append(count)
错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-174-afeee7d3d179> in <module>()
3
4 for count, item in enumerate(data.data):
----> 5 if any(x in item for x in a):
6 comp_rows.append(count)
<ipython-input-174-afeee7d3d179> in <genexpr>((x,))
3
4 for count, item in enumerate(data.data):
----> 5 if any(x in item for x in a):
6 comp_rows.append(count)
TypeError: argument of type 'float' is not iterable
有人能帮我吗?你知道吗
如果您的
data.data
是一个字符串列表,但是在那里找到了一个浮点值,那么它就可以工作了。尝试替换if any(x in item for x in a):
与if any(x in str(item) for x in a):
相关问题 更多 >
编程相关推荐