I'm trying to read in a bunch of files into a pandas data frame using read_csv(), however the files are formatted like this:
# {parms: values,
# more params: more values,
# something else,
# params: values}
co1 col2 col3
value value value
Essentially, if I removed the part that starts with #, my file would be a perfectly easily-readable tsv.
Do I have to process all these files first to remove this header (reading it in and writing back every line that doesn't begin with #) or is there some way to do this directly using read_csv or another similar function?
When I try to read it in normally, it of course returns a rather broken-looking pandas data frame.
You can remove the headings that start with # before reading them like this:
The only thing to note, is that it will modify your file, so if you would like to keep it the same, then make a copy of it first like this: