- 提取指定列
df.loc[:,[colname_list]]
#iloc和loc效率相近。loc按col名称即标签取,iloc按序号取
- 时间的格式化输出
import time
time.strftime('%Y-%m-%d %H:%M:%S',time.localnow())
- 导出为excel
df.to_excel('fileurl.xlsx',index=False)
#xlsx文件名不支持特殊字符
df.loc[:,[colname_list]]
#iloc和loc效率相近。loc按col名称即标签取,iloc按序号取
import time
time.strftime('%Y-%m-%d %H:%M:%S',time.localnow())
df.to_excel('fileurl.xlsx',index=False)
#xlsx文件名不支持特殊字符