to_pandas

to_pandas#

NestedFrame.to_pandas(list_struct=False, large_list=False) DataFrame[source]#

Convert to an ordinal pandas DataFrame, with no NestedDtype series.

NestedDtype is cast to pd.ArrowDtype

Parameters:
  • list_struct (bool) – If True, cast nested columns to pandas struct-list arrow extension array columns. If False (default), cast nested columns to list-struct array columns.

  • large_list (bool) – If False (default), use regular list_ (int32 offsets). Set to True to use large_list (int64 offsets), which is required when the total number of nested elements across all rows exceeds 2**31 - 1.

Returns:

Ordinal pandas DataFrame.

Return type:

pd.DataFrame

Examples

>>> from nested_pandas.datasets.generation import generate_data
>>> nf = generate_data(5,5, seed=1)
>>> nf.to_pandas()
          a         b                                             nested
0  0.417022  0.184677  {'t': array([ 8.38389029, 13.4093502 , 16.0148...
1  0.720324  0.372520  {'t': array([13.70439001,  8.34609605, 19.3652...
2  0.000114  0.691121  {'t': array([ 4.08904499, 11.17379657,  6.2684...
3  0.302333  0.793535  {'t': array([17.56234873,  2.80773877, 13.8464...
4  0.146756  1.077633  {'t': array([ 0.54775186,  3.96202978, 17.5277...