示例
Order_ID Name
1 Man
2 Boss
5 Don
7 Lil
9 Dom
10 Bob
想要得到的输出为:
3 4 6 8 are the missing Order_ID
最佳答案
尝试使用 list
理解与 range
:
print([i for i in range(1, 10) if i not in df['Order_ID']])
输出:
[3, 4, 6, 8]
关于python - 如何使用 python pandas 找到丢失的索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65665195/