Hi Charles,

In Python [1], the "zip" function does this task:


 zip([1, 2, 3], [4, 5, 6]) --> [(1, 4), (2, 5), (3, 6)]


When you gathered the list of functions for the Drill book, did you come across 
anything like this in Drill? I presume you didn't, hence the question. I did a 
quick (incomplete) check and didn't see any likely candidates.

Perhaps you could create such a function.

Once you have the zipped result, you could flatten to get the pairs as rows.


Thanks,
- Paul

 

    On Wednesday, April 10, 2019, 5:26:10 PM PDT, Charles Givre 
<cgi...@gmail.com> wrote:  
 
 Hello Drillers,
I have a query question for you.  I have some really ugly data that has a field 
like this:

compound_field : { “field_1”: [1,2,3],
    “field_2”:[4,5,6]
)

I would like to map fields 1 and 2 to columns so that the end result is:

field1 | field2
1        | 4
2      |  5
3      |  5

I thought flatten() would be the answer, however, if I flatten the columns, I 
get the following result:

field1 | field2
1      |  4
1      |  5
1      |  6

Does anyone have any suggestions?
Thanks,
—C  

Reply via email to