I have a CSV file structured like this:
# Samples 1
1,58
2,995
3,585
# Samples 2
15,87
16,952
17,256
# Samples 1
4,89
5,63
6,27
Is there any way in Python 3.x, how to parse a file structured like this without having to manually go through it line-by-line?
I'd like to have some function, which will automatically parse it considering the labels, like this:
>> parseLabeledCSV(['# Samples 1', '# Samples 2'], fileName)
[{1:58,2:995,3:585,4:89,5:63,6:27}, {15:57, 16:952, 17:256}]
parse, split into columns? There are many python packages specialising in reading in csv data.