amirziai/flatten

new function flatten_preserve_lists to limit flattening and preserve list structure

Closed this issue · 0 comments

I propose to add a new function called flatten_preserve_list.

It would create a new record for every element in a list, akin to a left join between two tables in sql. It adds options max_list_index, which controls how many list indices are processed, and max_depth, which controls how many recursions are permitted. Given that the result of this function may be very large, these options help reduce output size and can be used for quick data investigation.

This function requires import of copy, re, and math libraries.

See below for the pull request. It works, but still contains some debug statement which I will remove if it is accepted.