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.
在 pandas 中,您可以通过以下方式执行此操作:
df.loc[:,~df.columns.duplicated()]
df.columns.duplicated()返回一个表示重复列的布尔数组
df.columns.duplicated()
python pandas删除重复的列