u010001866
2021-01-17 21:56Python数据筛选
50现在有一组数据user_data如下
user_id name review_count yelping_since useful funny cool
0 ntlvfPzc8eglqvk92iDIAw Rafael 553 2007-07-06 03:27:11 628 225 227
1 FOBRPlBHa3WPHFB5qYDlVg Michelle 564 2008-04-28 01:29:25 790 316 400
2 zZUnPeh2hEp0WydbAZEOOg Martin 60 2008-08-28 23:40:05 151 125 103
3 QaELAmRcDc5TfJEylaaP8g John 206 2008-09-20 00:08:14 233 160 84
4 xvu8G900tezTzbbfqmTKvA Anne 485 2008-08-09 00:30:27 1265 400 512
然后现在有一个类型为series的id_list包含了其中几个user_id.
user_id
0 ntlvfPzc8eglqvk92iDIAw
1 zZUnPeh2hEp0WydbAZEOOg
2 V3t6VJNcO7yXslIJHG7nyA
3 QaELAmRcDc5TfJEylaaP8g
其中包含的id有的在数据集的use_id中存在,有的不在数据集的use_id中存在。
现在想通过这一列id_list进行过筛,找出user_id中包含id_list中存在的数据的数据,请问代码怎么写。
我尝试了很多
以下代码都不行
uuid = uuid.filter(id_list)
uuid = user_data[user_data['user_id'],]==id_list]
uuid = user_data[user_data['user_id'] in id_list]
- 点赞
- 回答
- 收藏
- 复制链接分享
7条回答
为你推荐
- 数据显示是NaN,却不能通过判断是否是nan来选中
- python
- 1个回答
- 请问Python中如何用groupby抓取指定列指定值的数据?
- python
- 1个回答
- 怎么实现python输入文字在数据库中筛选出数据?
- python
- mysql
- 1个回答
- microrna筛选reads长度
- linux
- python
- perl
- 数据挖掘
- 2个回答
- python3中使用xpath无法定位,为什么一直返回空列表?
- python
- html5
- 3个回答
换一换