def to_records(self, index=True, convert_datetime64=None,<EOL>column_dtypes=None, index_dtypes=None):
if convert_datetime64 is not None:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT:version>",<EOL>FutureWarning, stacklevel=<NUM_LIT:2>)<EOL><DEDENT>if index:<EOL><INDENT>if is_datetime64_any_dtype(self.index) and convert_datetime64:<EOL><INDENT>ix_vals = [self.index.to_pydatetime()]<EOL><DEDENT>else:<EOL><INDENT>if isinstance(self.index, MultiIndex):<EOL><INDENT>ix_vals = lmap(np.array, zip(*self.index.values))<EOL><DEDENT>else:<EOL><INDENT>ix_vals = [self.index.values]<EOL><DEDENT><DEDENT>arrays = ix_vals + [self[c].get_values() for c in self.columns]<EOL>count = <NUM_LIT:0><EOL>index_names = list(self.index.names)<EOL>if isinstance(self.index, MultiIndex):<EOL><INDENT>for i, n in enumerate(index_names):<EOL><INDENT>if n is None:<EOL><INDENT>index_names[i] = '<STR_LIT>' % count<EOL>count += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>elif index_names[<NUM_LIT:0>] is None:<EOL><INDENT>index_names = ['<STR_LIT:index>']<EOL><DEDENT>names = lmap(str, index_names) + lmap(str, self.columns)<EOL><DEDENT>else:<EOL><INDENT>arrays = [self[c].get_values() for c in self.columns]<EOL>names = lmap(str, self.columns)<EOL>index_names = []<EOL><DEDENT>index_len = len(index_names)<EOL>formats = []<EOL>for i, v in enumerate(arrays):<EOL><INDENT>index = i<EOL>if index < index_len:<EOL><INDENT>dtype_mapping = index_dtypes<EOL>name = index_names[index]<EOL><DEDENT>else:<EOL><INDENT>index -= index_len<EOL>dtype_mapping = column_dtypes<EOL>name = self.columns[index]<EOL><DEDENT>if is_dict_like(dtype_mapping):<EOL><INDENT>if name in dtype_mapping:<EOL><INDENT>dtype_mapping = dtype_mapping[name]<EOL><DEDENT>elif index in dtype_mapping:<EOL><INDENT>dtype_mapping = dtype_mapping[index]<EOL><DEDENT>else:<EOL><INDENT>dtype_mapping = None<EOL><DEDENT><DEDENT>if dtype_mapping is None:<EOL><INDENT>formats.append(v.dtype)<EOL><DEDENT>elif isinstance(dtype_mapping, (type, np.dtype, str)):<EOL><INDENT>formats.append(dtype_mapping)<EOL><DEDENT>else:<EOL><INDENT>element = "<STR_LIT>" if i < index_len else "<STR_LIT>"<EOL>msg = ("<STR_LIT>"<EOL>"<STR_LIT>").format(dtype=dtype_mapping,<EOL>element=element, name=name)<EOL>raise ValueError(msg)<EOL><DEDENT><DEDENT>return np.rec.fromarrays(<EOL>arrays,<EOL>dtype={'<STR_LIT>': names, '<STR_LIT>': formats}<EOL>)<EOL>
Convert DataFrame to a NumPy record array.

Index will be included as the first field of the record array if
requested.

Parameters
----------
index : bool, default True
    Include index in resulting record array, stored in 'index'
    field or using the index label, if set.
convert_datetime64 : bool, default None
    .. deprecated:: 0.23.0

    Whether to convert the index to datetime.datetime if it is a
    DatetimeIndex.
column_dtypes : str, type, dict, default None
    .. versionadded:: 0.24.0

    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
    .. versionadded:: 0.24.0

    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.

    This mapping is applied only if `index=True`.

Returns
-------
numpy.recarray
    NumPy ndarray with the DataFrame labels as fields and each row
    of the DataFrame as entries.

See Also
--------
DataFrame.from_records: Convert structured or record ndarray
    to DataFrame.
numpy.recarray: An ndarray that allows field access using
    attributes, analogous to typed columns in a
    spreadsheet.

Examples
--------
>>> df = pd.DataFrame({'A': [1, 2], 'B': [0.5, 0.75]},
...                   index=['a', 'b'])
>>> df
   A     B
a  1  0.50
b  2  0.75
>>> df.to_records()
rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)],
          dtype=[('index', 'O'), ('A', '<i8'), ('B', '<f8')])

If the DataFrame index has no label then the recarray field name
is set to 'index'. If the index has a label then this is used as the
field name:

>>> df.index = df.index.rename("I")
>>> df.to_records()
rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)],
          dtype=[('I', 'O'), ('A', '<i8'), ('B', '<f8')])

The index can be excluded from the record array:

>>> df.to_records(index=False)
rec.array([(1, 0.5 ), (2, 0.75)],
          dtype=[('A', '<i8'), ('B', '<f8')])

Data types can be specified for the columns:

>>> df.to_records(column_dtypes={"A": "int32"})
rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)],
          dtype=[('I', 'O'), ('A', '<i4'), ('B', '<f8')])

As well as for the index:

>>> df.to_records(index_dtypes="<S2")
rec.array([(b'a', 1, 0.5 ), (b'b', 2, 0.75)],
          dtype=[('I', 'S2'), ('A', '<i8'), ('B', '<f8')])

>>> index_dtypes = "<S{}".format(df.index.str.len().max())
>>> df.to_records(index_dtypes=index_dtypes)
rec.array([(b'a', 1, 0.5 ), (b'b', 2, 0.75)],
          dtype=[('I', 'S1'), ('A', '<i8'), ('B', '<f8')])