I have a .txt file where I have text headers and numerical data. I am working with python 2.7, and am using pandas and numpy in my work. The structure of the file is like the picture shown below:
The data for this file can be gotten from here. In this file, I want to get a list of all tags. For example, in the picture shown above, I want the list to look like the following:
[Tag1, Tag1, Tag1, Tag5, Tag5, Tag6, Tag6]
At present, I am reading the file using:
df = pd.read_csv('dum.txt',sep='\t', header=[0,1], index_col=0)
When I try lst = df.columns.levels[1], I get Index([u'Tag1', u'Tag5', u'Tag6'], dtype='object', name=u'Tag') as my output instead of the list that I desire.
How can I get a list of tags in my problem, i.e. [Tag1, Tag1, Tag1, Tag5, Tag5, Tag6, Tag6] ? Thanks in advance.
