11List/Dictionary Data Format
The data format called list in R or dictionary in Python, usually shortened as dict, has a long history in the management of data, being one of the simpler but useful evolutions of basic data formats like arrays and matrices. Arrays and matrices by definition have data of the same type, and the most reasonable evolution is to have data formats that allow for data of different types. We have already seen this throughout the whole book with the data frame format, which basically extends the notion of a matrix with columns (variables) possibly of different types. The list/dict data format follows the same logic but is realized in an alternative way with respect to the data frame, with different pros and cons. The following is an example of a list/dict data structure describing personal information:
This is a typical form of a list/dict (technically, it uses Python syntax), with information expressed as pairs name:value (sometimes also called key:value or label:value) and organized in a highly structured ...
Get Data Science Fundamentals with R, Python, and Open Data now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.