我有一个数据框,其中一些索引是字符串值。如何删除索引为字符串值或非整数的数据行?感谢您的帮助。
最佳答案
我建议使用 bool 索引:
mask = frame.index.map(lambda x: not isinstance(x, str))
frame = frame[mask]
关于python - Pandas 删除索引为字符串的数据行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12450924/