larray.Array.to_frame

Array.to_frame(fold_last_axis_name=False, dropna=None) DataFrame[source]

Convert an Array into a Pandas DataFrame.

Parameters
fold_last_axis_namebool, optional

Defaults to False.

dropna{‘any’, ‘all’, None}, optional
  • any : if any NA values are present, drop that label

  • all : if all values are NA, drop that label

  • None by default.

Returns
Pandas DataFrame

Notes

Since pandas does not provide a way to handle metadata (yet), all metadata associated with the array will be lost.

Examples

>>> arr = ndtest((2, 2, 2))
>>> arr
 a  b\c  c0  c1
a0   b0   0   1
a0   b1   2   3
a1   b0   4   5
a1   b1   6   7
>>> arr.to_frame()                                                             
c      c0  c1
a  b
a0 b0   0   1
   b1   2   3
a1 b0   4   5
   b1   6   7
>>> arr.to_frame(fold_last_axis_name=True)                                     
        c0  c1
a  b\c
a0 b0    0   1
   b1    2   3
a1 b0    4   5
   b1    6   7