import pandas as pd
df = pd.DataFrame(
[['Tom', 91, 80, 94.5],
['Emmy', 98, 95, 96],
['Rubeus', 87, 81, 87],
['Voldemort', 82, 86, 91],
['Dumbledore', 99, 100, 98],
['Axel', 75, 85, 90]],
columns=['name', 'algebra', 'python', 'java'])
arr = df.to_numpy()
print(df.dtypes, '\n')
print(arr, '\n')
print(arr.dtype)
'''
run:
name object
algebra int64
python int64
java float64
dtype: object
[['Tom' 91 80 94.5]
['Emmy' 98 95 96.0]
['Rubeus' 87 81 87.0]
['Voldemort' 82 86 91.0]
['Dumbledore' 99 100 98.0]
['Axel' 75 85 90.0]]
object
'''