At the moment i try to read a *.txt with "read_csv". Works fine so far.
In[1]: df = pd.read_csv('Data.txt', skiprows=range(0,4), sep='\t', header = 0, skipinitialspace = True)
If i set the header = 0
i get the Elementlabels, but they repeat for each value of CTF1, CTF2, CTF3
... and so on. So there are multiple Elements in the Header with the same value:
20052065, 20052065 .1, 20052065 .2 ... --> 20052065 .11
In[2]: print(df)
Out[2]:
Unnamed: 0 ELEMENT 20052065 20052066 20052082 20052087 20052089 \
0 TIME[s] TEMP[C] CTF1 CTF1 CTF1 CTF1 CTF1
1 0.000 24.000 -4.234 -6.728 -14.386 -4.356 -6.926
2 60.000 36.137 -29.308 -24.795 -26.937 -30.134 -24.735
3 120.000 49.013 -48.825 -36.383 -29.986 -49.897 -35.748
20052090 20052116 20052119 ... 20052116.10 20052119.10 20052065.11 \
0 CTF1 CTF1 CTF1 ... CU3 CU3 CU_M
1 -10.205 -9.934 -14.012 ... 0.001 0.001 0.003
2 -23.474 -23.982 -27.175 ... -0.016 -0.015 0.023
3 -28.007 -28.904 -29.788 ... -0.035 -0.032 0.036
So i would like to create a MultiIndex with CTF1, CTF2, CTF3,... as the "upper" Index and down there the Elementlabels. In the end i would like to select a Value by its 1. Level and its 2. Level Index. Got no Idea how to get this work. :-/
The *.txt looks like: