loading a pandas table from a weird txt file

39 Views Asked by At

I'm working with a package called qiime2, that generates me a txt file I want to load to pandas as a table. An exapmle for the txt format is the following: enter image description here

The format is quite quacky. I want to load as a pandas table the part from line 10 downward to a specified line, with the first coulmn in each line ("L1S105", "L1S140"..) being the index, coulmns will be named from 1 to 31, and all the values will fit right in (for e.g, -0.4034.. will be at["L1S105", 1].

I tried to load the whole file as a pandas table and than manipulate but got an error. after writing on_bad_line = "skip" not much of the table was left.

0

There are 0 best solutions below