导入数据的txt文本中列是有列名的
导入后的数据没有列名
import numpy as np
import pandas as pd
import datetime
from dateutil.parser import parse
data1 = pd.read_csv('result.txt',sep='\t')
data1 = pd.DataFrame(data1)
data1 = np.array(data1)
for i in range(data1.shape[0]-1):
data1[i][3] = parse(data1[i][3])
data1[i][3] = data1[i][3].strftime("%Y-%m-%d")
data1 = pd.DataFrame(data1)
data1 = data1.groupby(data1['用气点编码']).sort_values(by='数据日期')
data1.to_csv('data_out.txt', sep='\t')