python 给csv加标题
我有一堆雷达相关的csv数据,但是第一行没有标题,后面进行计算不方便,所以需要给数据加标题
#!usr/bin/env python # -*- coding:utf-8 -*- """ @author: Suyue @file: biaoti.py @time: 2024/08/13 @desc: """ import pandas as pd df = pd.read_csv('G:/8_area_.csv',header=None,encoding='utf_8',names=['坐标1','坐标2','时间','均值','归一方差','面积','占比','30面积','30/20','40面积','40/30']) df.to_csv('G:/8_area.csv',encoding='utf_8_sig',index_label=False)