I have a dataset that is structured in a csv like this:
Name,code,count
Adam,01,48
Bill,01,32
Chris,01,4
Carl,01.01,5
Dave,01.01,1
David,01.01,1
Eric,01.01.01,26
Earl,01.01.01.01,2
Frank,01.01.01.01,2
Greg,01.01.01.02,2
Harold,01.01.01.03,7
Ian,01.01.01.03,3
Jack,01.01.01.03,1
John,01.01.01.04,10
Kyle,01.01.01.04,2
Larry,01.01.03.01,3
Mike,01.01.03.01.01,45
Nick,01.01.03.01.01.01,1
Oliver,01.01.03.01.01.02,16
Paul,01.01.03.01.01.03,23
I want to make a dictionary in python where the "name" and the "count" are key:value pairs (which is easy enough), but I want to organize a hierarchy based on the "code" number. i.e 01.01 is a child of 01 and I am not sure how to iterate over the data to make this happen. I eventually want to do a json dump of the whole structure, but it is how to structure the hierarchy that is getting me down. Any help is greatly appreciated.
01elements at the beginning - how the01.01element should fit into the hierarchy? To which element to assign it?