您好,我正在学习数据科学,正在制作一个具有一些属性的大数据公司列表。
目前我的数据框数据看起来像这样。
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...
我希望使用某些关键字(例如“大数据”)对“数据”列进行排序,并使用行创建新的数据框。
我想首先找到拟合行,然后将它们放入列表并根据行列表对数据帧,数据进行排序,但第一部分出现错误。
我的代码:
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
有人可以帮我吗?
答案 0 :(得分:0)
如果你的data.data
是一个字符串列表,但在那里找到了一个浮点数,它会工作。尝试更换
if any(x in item for x in a):
与if any(x in str(item) for x in a):