pandas.merge根据一个或多个键将行进行连接。
pandas.concat沿轴向连接,默认axis=0,生成另一个Series
排序后的合集('outer',join外连接),join='inner'交集
多层索引使用keys参数
参考https://www.jb51.net/article/148407.htm
import os
import pandas as pd
import numpy as np
import glob
path=r'E:\2017'
file=glob.glob(os.path.join(path, "sphere*.txt"))
print(file)
db=[]
for f in file:
db.append(pd.read_csv(f,sep='\s+',header=None,index_col=0,nrows=96))
df=pd.concat(db)
#lid_04012=pd.read_csv(r'E:\学业\大组\小组\2017\Mar31Apr02cst.txt',sep='\s+',header=None,index_col=0)
#lid_04012=lid_04012[96:]
#lid_0930=pd.read_csv(r'E:\学业\大组\小组\2017\depol532-Sep29-Oct01cst.txt',sep='\s+',header=None,index_col=0)
#lid_0930=lid_0930[96:192]
#half=pd.concat([lid_04012,lid_0930,result])
hgt=np.arange(30,6030,30).reshape(1,200)
df.columns=hgt
result.sort_index(level=0)
result.to_csv(r'E:\lidar_sphere.csv', index=True, sep=',')
网友评论