bigframes.pandas.DataFrame.to_records#
- DataFrame.to_records(index: bool = True, column_dtypes=None, index_dtypes=None, *, allow_large_results=None) recarray[source]#
Convert DataFrame to a NumPy record array.
Index will be included as the first field of the record array if requested.
Examples:
>>> df = bpd.DataFrame({'col1': [1, 2], 'col2': [3, 4]}) >>> df.to_records() rec.array([(0, 1, 3), (1, 2, 4)], dtype=[('index', '<i8'), ('col1', '<i8'), ('col2', '<i8')])
- Parameters:
index (bool, default True) – Include index in resulting record array, stored in ‘index’ field or using the index label, if set.
column_dtypes (str, type, dict, default None) – If a string or type, the data type to store all columns. If a dictionary, a mapping of column names and indices (zero-indexed) to specific data types.
index_dtypes (str, type, dict, default None) – If a string or type, the data type to store all index levels. If a dictionary, a mapping of index level names and indices (zero-indexed) to specific data types.
allow_large_results (bool, default None) –
If not None, overrides the global setting to allow or disallow large query results over the default size limit of 10 GB.
This mapping is applied only if index=True.
- Returns:
NumPy ndarray with the DataFrame labels as fields and each row of the DataFrame as entries.
- Return type:
np.recarray