pandas重写Q6

# -*- coding: utf-8 -*-
"""
Created on Mon Jul 13 19:17:05 2015

@author: Administrator
"""

import pandas as pd
import numpy as np
import os

InputDir = r'D:\R\P'
rootdir = InputDir
pieces = []
heightIndex = range(100,550,60)

for parent,dirnames,filenames in os.walk(rootdir):
     for filename in filenames:

        df=pd.read_csv(os.path.join(parent,filename),skiprows=3,header=None,nrows=8,sep=' ').iloc[:,2]

        pieces.append(df)

        sudu = pd.concat(pieces,axis = 1,ignore_index=True).replace('/////',np.nan).astype(np.float)

sudu.index = heightIndex
sudu12 = sudu - 12
abssudu12 = sudu12.abs()
suduLowLevel = abssudu12.min()
heightLowLevel = abssudu12.idxmin()
pieces = [suduLowLevel,heightLowLevel]
result = pd.concat(pieces,ignore_index=True,axis=1).T

;