I have a text file (data.txt) like below:
name height weight
A 15.5 55.7
B 18.9 51.6
C 17.4 67.3
D 11.4 34.5
E 23.4 92.1
I want to make list in python for each column using pandas.
import pandas
with open (pandas.read_csv('data.txt')) as df:
name= df.icol(0)
height= df.icol(1)
weight= df.icol(2)
print (name)
print (height)
print (weight)
I also want to avoid the headers (name, height, weight) from the list.
print (df) provides as follows:
name\theight\tweight
0 A\t15.5\t55.7
1 B\t18.9\t51.6
2 C\t17.4\t67.3
3 D\t11.4\t34.5
4 E\t23.4\t92.1