datatable.Frame.to_numpy()¶
Convert frame into a 2D numpy array, optionally forcing it into the specified stype/dtype.
In a limited set of circumstances the returned numpy array will be created as a data view, avoiding copying the data. This happens if all of these conditions are met:
the frame has only 1 column, which is not virtual;
the column’s type is not string;
the
stypeargument was not used.
In all other cases the returned numpy array will have a copy of the frame’s data. If the frame has multiple columns of different stypes, then the values will be upcasted into the smallest common stype.
If the frame has any NA values, then the returned numpy array will
be an instance of numpy.ma.masked_array.
Parameters¶
stype | numpy.dtype | str | typeCast frame into this stype before converting it into a numpy array.
intConvert only the specified column; the returned value will be a 1D-array instead of a regular 2D-array.
numpy.arrayImportErrorIf the numpy module is not installed.