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
65 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
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
17 views
0 votes
1 answer
0 votes
1 answer
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
602 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
24 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
63 views