运行 ❯
获取属于您
自己的 Python
服务器
×
更改方向
更改主题,明暗
转到 Spaces
import pandas as pd data = { "name": ["John", "Mary", "John", "Sally", "Mary"], "age": [40, 30, 40, 50, 30], "city": ["Bergen", "Oslo", "Stavanger", "Oslo", "Oslo"] } df = pd.DataFrame(data) s = df.duplicated(subset=["name", "age"]) print(s) #This example only compares "name" and "age", and #column 2 is identical to column 0, #column 4 is identical to column 1,
0 False 1 False 2 True 3 False 4 True dtype: bool