-
-
Notifications
You must be signed in to change notification settings - Fork 592
Description
If headers are defined in a Dataset it would be helpful to allow element access within a row of the Dataset by column label in addition to index based access. Issue #22 suggested using namedtuples for this but --while acknowledging the general usefulness of such a feature-- was discarded because namedtuples would not support append, etc.
Implementing this via OrderedDicts should be possible though. It would require (it seems only in tablib/core.py on a first pass):
- Row constructor to accept an additional
headersargument _set_headersto be augmented to update existing rows with new column labels- Changes to Row methods
insert,__getitem__,__setitem__, and updates/changes to a few other special methods in Dataset and Row
It would introduce some overhead but given that Tablib is aimed at use cases "below" the Pandas level that might be acceptable and should not break the API.
I'm happy to give this a shot but --given that it will require changes in quite a few places in core.py-- would appreciate some feedback if (a) people still think that this would indeed be useful and (b) anyone sees a reason why doing this as outlined above is not a good idea (or may not even work at all...).
Many thanks!