I have some csv files I want to read, which for whatever reason is formatted like this
A B C
1 3 1
2 2 2
3 1 3
D
1
2
3
The problem here is that column D is below the other columns, and this makes Pandas very unhappy, once it finishes reading column A, and dives straight into D's column name string.
I can of course read it like
pd.read_csv(file, skiprows=1, nrows = rows_in_A_B_C)
Basically, nrows = length_of_A_B_C
. Problem is, I don't know the number of rows before D, and I can't read the csv until I do.
How can I solve this? Can I stop reading rows based on a condition instead, such as when I hit the header for D?