小编Mas*_*dou的帖子

Python Pandas-如何使用键的存在来过滤具有包含字典的列的数据框?

具有包含字典列的数据框

d = {'p1':[{'Apple':10},{'Ball': 20, 'Cat': 30}]}
df = pd.DataFrame(data=d)
Run Code Online (Sandbox Code Playgroud)
    p1
0   {'Apple': 10}
1   {'Ball': 20, 'Cat': 30}
Run Code Online (Sandbox Code Playgroud)

我想过滤键“ Ball”所在的行。

    p1
1   {'Ball': 20, 'Cat': 30}
Run Code Online (Sandbox Code Playgroud)

python dictionary key filter pandas

3
推荐指数
1
解决办法
39
查看次数

标签 统计

dictionary ×1

filter ×1

key ×1

pandas ×1

python ×1