Python Excel 去重


原文:https://blog.csdn.net/weixin_44266650/article/details/88416718
原文:https://www.icode9.com/content-1-230802.html
官方原文:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_excel.html
官方原文:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_excel.html



mark:不得不说python的这些库用着真是不要太爽。。。


代码如下

# 原文:https://blog.csdn.net/weixin_44266650/article/details/88416718
# 原文:https://www.icode9.com/content-1-230802.html
# 原文:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_excel.html

import pandas as pd

df = pd.read_excel('test.xlsx')
print(type(df))

# inplace=True:删掉重复的行
df.drop_duplicates(['标题'], inplace=True)

# index=False:不把索引写入行
df.to_excel('out.xlsx', index=False)

print('去重完成')



去重前

去重后


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM