Use defaultdicts for headers. Simplify data member functions.
Occasionally Qt calls these methods with column -1 and this exception otherwise goes unhandled. The default None return from Python functions should be sufficient.