This is exactly right. That issue is dealing with how to split/store the data (arbitrary data, actually) in a way that is conducive to displaying it as a table using HTML.
I’m not sure which sections you do or don’t understand, but I hope it’s been clear that this isn’t an approach you want to take if you’re actually doing data analysis of any sort.
In any case:
states_dict["headers"]
tells you what the keys of each sub-dictionary are, and also gives a “nicer” name to print out as the table header for the column corresponding to that key. So the value under states_dict["states"][1]["name"]
should print under the header "Name"
(because that’s the value that goes with "name"
in the headers dict). If that sounds convoluted, it’s because it is!
As a side note in general, to figure out what code snippets like this do (and how) I suggest working in the REPL. Copy paste that code then play around with states_dict
result until you have a feel for how it works.