From 195f3915988378e5b39af3b1a1f65ad3e6912106 Mon Sep 17 00:00:00 2001 From: sipp11 Date: Wed, 6 Aug 2014 15:13:42 +0700 Subject: [PATCH] s8 header bug fix --- s7.py | 3 ++- s8.py | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/s7.py b/s7.py index 50343b0..2f97222 100755 --- a/s7.py +++ b/s7.py @@ -17,7 +17,7 @@ No of R ของคุณ ======= TOTAL -- ถ้าต้องการทั แต่ว่า ผมไม่รับรองว่าจะใช้ได้ทั้งหมดเพราะว่า มันก็ขึ้นกับหลายอย่าง เช่น 1Ts มีไม่กี่อันอาจจะ error มั้ง? โดยเฉพาะเวลา random ''' -NOT_ARG = '3Ts' +NOT_ARG = 'all' TOTAL = 20 SRC_PATH = os.path.join(TARGET_DIR, 'part6') @@ -32,6 +32,7 @@ def get_yynn_count(cols): n += 2 return n + def get_by_order(): for m in MODEL_LIST: result = [] diff --git a/s8.py b/s8.py index c5ff574..80a2806 100755 --- a/s8.py +++ b/s8.py @@ -73,20 +73,31 @@ def middleman(ls, rs): def main(): - header = [ - 'lo_id', '', - ] + ['' for i in xrange(0, 19)] + header = ['LO_xxx', '____', ] for m in MODEL_LIST: l_list, lo_data = get_test_data(m) - m_header = header[:] - m_header[1] = m for i in '1234': + m_header = header[:] + m_header[1] = m ros = get_ro_data(m, i) for r in ros: m_header.append(r[0]) result = middleman(lo_data, ros) output_name = '%s-%s.csv' % (m, i) - result = [m_header] + result + + # process header -- get ind of first R_xxx + number_ind = 0 + cnt_ind = 0 + for i in result[0]: + try: + float(i) + number_ind = cnt_ind + cnt_ind = 0 + break + except ValueError: + cnt_ind += 1 + __h = m_header[:2] + ['_' for i in xrange(0, number_ind-2)] + m_header[3:] + result = [__h] + result create_csv(output_name, result, directory='part8') main()