Python Excel 对一整列重新赋值


# 原文:https://blog.csdn.net/sscc_learning/article/details/76993816
# 原文:https://www.cnblogs.com/vamei/archive/2013/03/12/2954938.html


import pandas as pd
import os


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


# 对列重新赋值
df["访问时间"] =['2020-05-15 %s' % i for i in df["访问时间"]]


list_excel = []
list_excel.append(df)

writer = pd.ExcelWriter('test2.xlsx')
pd.concat(list_excel).to_excel(writer,'sheet1',index=False)
writer.save()

print('ok')


免责声明!

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



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