Jan-24-2017, 07:48 AM
my code from previous post works just fine with this sample csv file:
print '\n\nusing pandas with row 3 as column names\n' import pandas as pd DF = pd.read_csv('myfile.csv', skiprows=2) print DF.head(n=10) # print first 10 rows
Output:using pandas with row 3 as column names
Timestamp (yyyy-mm-dd HH:MM:SS) A Bong C D E F G H \
0 2015-01-01 00:00:SS 734 734 734 734 734 734.0 734 734
1 2015-01-01 01:00:SS 816 816 816 816 816 816.0 816 816
2 2015-01-01 02:00:SS 114 114 114 114 114 114.0 114 114
3 2015-01-01 03:00:SS 822 822 822 822 822 822.0 822 822
4 2015-01-01 04:00:SS 569 569 569 569 569 569.0 569 569
5 2015-01-01 05:00:SS 87 87 87 87 87 87.0 87 87
6 2015-01-01 06:00:SS 250 250 250 250 250 250.0 250 250
7 2015-01-01 07:00:SS 492 492 492 492 492 492.0 492 492
8 2015-01-01 08:00:SS 862 862 862 862 862 862.0 862 862
9 2015-01-01 09:00:SS 869 869 869 869 869 869.0 869 869
I J K
0 734 734 734
1 816 816 816
2 114 114 114
3 822 822 822
4 569 569 569
5 87 87 87
6 250 250 250
7 492 492 492
8 862 862 862
9 869 869 869
also without column names:print '\n\nusing pandas without column names\n' import pandas as pd DF = pd.read_csv('myfile.csv', skiprows=3, header=None) print DF.head(n=10) # print first 10 rows
Output:using pandas without column names
0 1 2 3 4 5 6 7 8 9 10 \
0 2015-01-01 00:00:SS 734 734 734 734 734 734.0 734 734 734 734
1 2015-01-01 01:00:SS 816 816 816 816 816 816.0 816 816 816 816
2 2015-01-01 02:00:SS 114 114 114 114 114 114.0 114 114 114 114
3 2015-01-01 03:00:SS 822 822 822 822 822 822.0 822 822 822 822
4 2015-01-01 04:00:SS 569 569 569 569 569 569.0 569 569 569 569
5 2015-01-01 05:00:SS 87 87 87 87 87 87.0 87 87 87 87
6 2015-01-01 06:00:SS 250 250 250 250 250 250.0 250 250 250 250
7 2015-01-01 07:00:SS 492 492 492 492 492 492.0 492 492 492 492
8 2015-01-01 08:00:SS 862 862 862 862 862 862.0 862 862 862 862
9 2015-01-01 09:00:SS 869 869 869 869 869 869.0 869 869 869 869
11
0 734
1 816
2 114
3 822
4 569
5 87
6 250
7 492
8 862
9 869