-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add util function to_records
to build records
#1377
Conversation
Add a new util function that helps building record values. Records are list of dictionaries, each dictionary has the same set of keys, they are set from the given list of headers. Each key is associated to a value from the given matrix of values. They are as many dictionaries as they are lines in the matrix. Each line in the matrix will be associated to a dictionary, each key is associated to a value from that line in the given order. Example: Headers: A B C Values: 1 2 3 7 8 9 Result: [ { A: 1, B: 2, C: 3}, {A: 7, B: 8, C: 9}] closes #1367 Signed-off-by: Alexandre Lavigne <[email protected]>
to_record
to build recordsto_records
to build records
this is good stuff, thank you :) we should also make this function more visible to users - it should be added to the docstring of (and migration guide readme - covered by #1376) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above comment
Thanks ! It's actually shorter than what I expected 🙄
I did not know if we want to make it into a single PR. I'll add it to the migration guide, and I'll add a mention about it in the doc string of What do you think of the outcome of that global change ? |
haha.. yes! a great one-liner eh
Do you mean the simplification of |
yes that's what I mean. you can once everything is merged, it might be easier to see the whole result. I'm working currently on the docstring upgrade + migration guide (that part is quite long to explain, new functions, removed methods etc) |
my apologies for merging this, I have restored the branch and reverted the merge commit with 51f9f25. You may need to create a new PR :/ |
Add a new util function that helps building record values. Records are list of dictionaries, each dictionary has the same set of keys, they are set from the given list of headers. Each key is associated to a value from the given matrix of values. They are as many dictionaries as they are lines in the matrix.
Each line in the matrix will be associated to a dictionary, each key is associated to a value from that line in the given order.
Example:
Headers: A B C
Values:
1 2 3
7 8 9
Result: [ { A: 1, B: 2, C: 3}, {A: 7, B: 8, C: 9}]
closes #1367