[ 
https://issues.apache.org/jira/browse/ARROW-4090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16932596#comment-16932596
 ] 

Antoine Pitrou commented on ARROW-4090:
---------------------------------------

I think it would probably be relatively easy for someone interested to submit a 
PR for this. Better if it's done on the C++ side.

> [Python] Table.flatten() doesn't work recursively
> -------------------------------------------------
>
>                 Key: ARROW-4090
>                 URL: https://issues.apache.org/jira/browse/ARROW-4090
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Python
>            Reporter: Francisco Sanchez
>            Priority: Minor
>             Fix For: 1.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> It seems that the pyarrow.Table.flatten() function is not working recursively 
> nor providing a parameter to do it.
> {code}
> test1c_data = {'level1-A': 'abc',
>                'level1-B': 112233,
>                'level1-C': {'x': 123.111, 'y': 123.222, 'z': 123.333}
>               }
> test1c_type = pa.struct([('level1-A', pa.string()),
>                          ('level1-B', pa.int32()),
>                          ('level1-C', pa.struct([('x', pa.float64()),
>                                                  ('y', pa.float64()),
>                                                  ('z', pa.float64())
>                                                 ]))
>                         ])
> test1c_array = pa.array([test1c_data]*5, type=test1c_type)
> test1c_table = pa.Table.from_arrays([test1c_array], names=['msg']) 
> print('{}\n\n{}\n\n{}'.format(test1c_table.schema,
>                               test1c_table.flatten().schema,
>                               test1c_table.flatten().flatten().schema))
> {code}
> output:
> {quote}msg: struct<level1-A: string, level1-B: int32, level1-C: struct<x: 
> double, y: double, z: double>>
>  child 0, level1-A: string
>  child 1, level1-B: int32
>  child 2, level1-C: struct<x: double, y: double, z: double>
>  child 0, x: double
>  child 1, y: double
>  child 2, z: double
> msg.level1-A: string
>  msg.level1-B: int32
>  msg.level1-C: struct<x: double, y: double, z: double>
>  child 0, x: double
>  child 1, y: double
>  child 2, z: double
> msg.level1-A: string
>  msg.level1-B: int32
>  msg.level1-C.x: double
>  msg.level1-C.y: double
>  msg.level1-C.z: double
> {quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to