I have a CSV file that looks like this:
1, 2, 3, 4, 5 ...
0, 1, 0, 1, 0 ...
0, 1, 0, 1, 0 ...
str1, str2, str3, str4, str5 ...
val1, val1.1, val1.2, val1.3, val1.4 ...
val2, val2.1, val2.2, val2.3, val2.4 ...
...
and I want to generate a dataframe that looks like this:
str2, str5
val1.1 val2.1
val2.1 val2.2
...
Here is my attempt:
for f in files:
data = pd.read_excel(f)
df = df.append(data)
df[5:10] //only care about values in rows below [str1, str2, ..., strn].
d = df.ix[:, '2' : '5']
d.columns = ['str2', 'str3', 'str4', 'str5'] //rename columns, reduce table size.
this produces:
str2 str3 str4 str5
val1.1 val1.2 val1.3 val1.4 ...
...
How do I eliminate str3
and str4
to get my original intended dataframe?