Return a Numpy representation of the DataFrame.


We recommend using DataFrame.to_numpy() instead.

Only the values in the DataFrame will be returned, the axes labels will be removed.


numpy.ndarray The values of the DataFrame.


  • Only numeric values supported as an output

  • The dtype will be a lower-common-denominator dtype (implicit upcasting);

    that is to say if the dtypes (even of numeric types) are mixed, the one that accommodates all will be chosen. Use this with care if you are not dealing with the blocks. e.g. If the dtypes are float16 and float32, dtype will be upcast to float32. If dtypes are int32 and uint8, dtype will be upcast to int32. By numpy.find_common_type() convention, mixing int64 and uint64 will result in a float64 dtype.


The values data of the DataFrame.
import pandas as pd
from numba import njit

def dataframe_values():
    df = pd.DataFrame({'age': [3,  29], 'height': [94, 170], 'weight': [31, 115]})
    result = df.values

    return result  # Numpy array of dataframe values: array([[3, 94, 31], [29, 170, 115]], dtype=int64)

$ python ./dataframe/
[[  3  94  31]
 [ 29 170 115]]

See also


Recommended alternative to this method.


Retrieve the index labels.


Retrieving the column names.