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
23 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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

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
10 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
178 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
12 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
39 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.