I have a csv file as such:
_LOG_START_1_,,,,,,,,, .,,,,,,,,, C1,D1,,,,,,,, TPROG_LAYER ,,,,,,,,, Layer_00 , 3.59ms,Layer_01 , 3.50ms,Layer_02 , 3.65ms,Layer_03 , 3.69ms,Layer_04 , 3.65ms Layer_05 , 3.64ms,Layer_06 , 3.63ms,Layer_07 , 3.66ms,Layer_08 , 3.68ms,Layer_09 , 3.68ms .,,,,,,,,, C2,D2,,,,,,,, TPROG_LAYER ,,,,,,,,, Layer_00 , 3.58ms,Layer_01 , 3.49ms,Layer_02 , 3.63ms,Layer_03 , 3.66ms,Layer_04 , 3.61ms Layer_05 , 3.66ms,Layer_06 , 3.63ms,Layer_07 , 3.63ms,Layer_08 , 3.66ms,Layer_09 , 3.64ms _LOG_END_1_,,,,,,,,,
I used the code:
pairs_ = dict() with open('text.txt', 'r') as file: for i, j in re.findall(r'(Layer_\d+)\s,\s(\d+\.\d+)ms', file.read()): pairs_.setdefault(i, []).extend([i, j]) pd.DataFrame(pairs_.values())
to put the pairs in parallel, it gave me:
however I want to keep the C1, D1, C2, D2 as such, (not at header):
Anyone one know how I can deal with it? much appreciation
https://stackoverflow.com/questions/67342743/add-additional-non-pairs-on-top-of-pairs-of-data May 01, 2021 at 11:56AM
没有评论:
发表评论