codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


Francisco Sanchez created ARROW-4090:
----------------------------------------

             Summary: 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: C++, Python
            Reporter: Francisco Sanchez


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)