循环Bash的问题

时间:2015-06-11 13:21:02

标签: arrays linux bash for-loop

我有这个bash代码:

import glob
import pandas as pd
import os

os.chdir('C:/Users/Joey/Desktop/GC_results')


def FID_extract1_to_9(filepath):

    path_pattern = filepath
    files = glob.glob(path_pattern) #finds all files with ending in 00* in the file path
    dataframes = [pd.DataFrame.from_csv(f, index_col=None) for f in files] 

    new_df = pd.DataFrame()

    for i, df in enumerate(dataframes):
        colname = 'Run {}'.format(i+1)
        selected_data = df['Unnamed: 3'].ix[12:16]  
        new_df[colname] = selected_data
    print new_df 
    new_df.to_csv('FID_11169_liquid.csv') #Enter name of output file here



def FID_extract9_to_96(filepath):

    path_pattern = filepath
    files = glob.glob(path_pattern)
    dataframes = [pd.DataFrame.from_csv(f, index_col=None) for f in files]

    new_dfa = pd.DataFrame()

    for i, df in enumerate(dataframes):
        colname = 'Run {}'.format(i+1)
        selected_data = df['Unnamed: 3'].ix[12:16]  
        new_dfa[colname] = selected_data
    print new_dfa 
    new_dfa.to_csv('FID_11169_Liquid.csv') 



def TCD_extract1_to_9(filepath):

    path_pattern = filepath
    files = glob.glob(path_pattern)
    dataframes = [pd.DataFrame.from_csv(f, index_col=None) for f in files]

    new_dfb = pd.DataFrame()

    for i, df in enumerate(dataframes):
        colname = 'Run {}'.format(i+1)
        selected_data = df['Unnamed: 3'].ix[12:16]  
        new_df[colname] = selected_data
    print new_dfb 
    new_dfb.to_csv('TCD_11169_liquid.csv') 



def TCD_extract9_to_96(filepath):

    path_pattern = filepath
    files = glob.glob(path_pattern)
    dataframes = [pd.DataFrame.from_csv(f, index_col=None) for f in files]

    new_dfc = pd.DataFrame()

    for i, df in enumerate(dataframes):
        colname = 'Run {}'.format(i+1)
        selected_data = df['Unnamed: 3'].ix[12:16]  
        new_dfa[colname] = selected_data
    print new_dfc 
    new_dfc.to_csv('TCD_11169_Liquid.csv') 



FID_extract1_to_9('C:/Users/Joey/Desktop/Cryostat Verification/GC results/11169_Cryo_1bar/FID_00*') #files directory

FID_extract9_to_96('C:/Users/Joey/Desktop/Cryostat Verification/GC results/11169_Cryo_1bar/FID_0*')

TCD_extract1_to_9('C:/Users/Joey/Desktop/Cryostat Verification/GC results/11169_Cryo_1bar/TCD_00*')

TCD_extract9_to_96('C:/Users/Joey/Desktop/Cryostat Verification/GC results/11169_Cryo_1bar/TCD_0*')

我的问题是代码没有显示globalDir的任何元素,即使它的长度是2

0 个答案:

没有答案