How do I convert a pandas dataframe to a numpy array using python?

0 votes

How do I convert a pandas dataframe to a numpy array using python?

May 22 in Machine Learning by Anu
264 views

1 answer to this question.

0 votes

Try something like this:

df.values
array([[nan, 0.2, nan],
       [nan, nan, 0.5],
       [nan, 0.2, 0.5],
       [0.1, 0.2, nan],
       [0.1, 0.2, 0.5],
       [0.1, nan, 0.5],
       [0.1, nan, nan]])
answered May 22 by Krishti

Related Questions In Machine Learning

0 votes
1 answer
0 votes
0 answers

How to know if a problem is solvable by machine learning?

I have recently started learning the machine. ...READ MORE

Nov 21 in Machine Learning by Hannah
• 17,150 points
29 views
0 votes
1 answer

Are there any python libraries that do multiple regressions?

You can use sklearn.linear_model.LinearRegression. Something like this: from ...READ MORE

answered May 22 in Machine Learning by Vinay
37 views
0 votes
1 answer

How to create Pandas series from numpy array?

Hi. Refer to the below command: import pandas ...READ MORE

answered Apr 1 in Python by Pavan
272 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to convert pandas dataframe to numpy array?

Irrespective of whether the dataframe has similar ...READ MORE

answered May 12 in Python by Rishi
2,644 views
0 votes
1 answer

How do I create a decision tree?

Let us consider the following example. Suppose a ...READ MORE

answered May 13 in Machine Learning by Fatima
72 views
0 votes
1 answer

Example to run KNN algorithm using python

Have a look at this one: from sklearn.datasets ...READ MORE

answered May 8 in Machine Learning by Harvy
177 views