Pandas dataframe.to_numpy() with specific dtypes

As both comments suggested:

array_from_df = df.to_records() # index=False to not include an index column

Outputs an a numpy.recarray with the correct data types in:

array_from_df.dtype.fields 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top