You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (JIRA)" <ji...@apache.org> on 2018/12/20 18:31:00 UTC

[jira] [Updated] (ARROW-4090) [Python] Table.flatten() doesn't work recursively

     [ https://issues.apache.org/jira/browse/ARROW-4090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes McKinney updated ARROW-4090:
--------------------------------
    Component/s:     (was: C++)

> [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
>              Labels: pull-request-available
>          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
(v7.6.3#76005)