So I have a fairly large set of data I need to analyze for my research. Each row in the pandas data frame has the entries of an eight by eight matrix in it. For each matrix entry there is 7 columns(1-6 are the amount of chemical used and 7 is the output). What I need to do is figure out how to take each of those matrix entries and make them into their own row in a new data frame. The columns look a little like this: POSCHEM11_1_LAYERS...POSCHEM11_6_LAYERS POS11_INTENSITY... POS88_INTENSITY
if you know of an easy way I could do this It would be greatly appreciated.
You must be logged in to post. Please login or register an account.
okay I made some progress, but now I have a different problem.
list=[] STD_list=[] layer_1_list =[] layer_2_list =[] layer_3_list =[] layer_4_list =[] layer_5_list =[] layer_6_list =[] out_list =[] for x in range(1,9): for y in range(1,9): list.append('%s%s'%(x,y))
for item in list: STD_list.append('POS%sSTD_DEV'%(item))
for item in list: layer_1_list.append('POS%sCHEM_1_LAYERS'%(item))
for item in list: layer_2_list.append('POS%sCHEM_2_LAYERS'%(item))
for item in list: layer_3_list.append('POS%sCHEM_3_LAYERS'%(item))
for item in list: layer_4_list.append('POS%sCHEM_4_LAYERS'%(item))
for item in list: layer_5_list.append('POS%sCHEM_5_LAYERS'%(item))
for item in list: layer_6_list.append('POS%sCHEM_6_LAYERS'%(item))
for item in list: out_list.append('POS%s_INTENSITY'%(item))
for item in STD_list: del df_SEAL[item]
new_frame_backbone= {1:[], 2:[], 3:[], 4:[], 5:[], 6:[], 'out':[]} for item in layer_1_list: new_frame_backbone[1].append(df_SEAL[item])
print(new_frame_backbone[1])
now when I print the first dictionary entry it should just be giving me the integer values for the first chemical's amount of layers but instead I get: Name: POS22CHEM_1_LAYERS, dtype: int64, 0 10 Name: POS23CHEM_1_LAYERS, dtype: int64, 0 20 Name: POS24CHEM_1_LAYERS, dtype: int64, 0 30 Name: POS25CHEM_1_LAYERS, dtype: int64, 0 40
how do I get just the stuff in the right hand column
-whorticulturist 7 years ago
You must be logged in to post. Please login or register an account.