There are two methods of going ahead with this, one is by hardcoding the data frame, which might get a little tedious when it comes to large datasets. The other way around is to use the functions provided by pandas.
Here is an explanation for both the methods:
You can try hardcoding it like this
df.values
array([[nan, 0.7, nan],
[nan, 0.65, 0.5],
[nan, 0.2, 0.5],
[0.1, 0.2, nan],
[0.1, 0.2, 0.9],
[0.6, nan, 0.5],
[0.1, nan, nan]])
The other way is to use a pandas function for it. These functions work on converting numPy arrays from al sorts of panda objects. This came out with pandas v0.24.0
- to_numpy(): Works for index, series and data frame
- array: works with index and series only