Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个数据框,其中一些索引是字符串值。如何删除索引为字符串值或非整数的数据行?谢谢你的帮助。
我建议使用布尔索引:
mask = frame.index.map(lambda x: not isinstance(x, str)) frame = frame[mask]