How to convert pandas dataframe to numpy array?

0 votes

I have two dataframes df and df2. One of them has data of same datatype and the other has data of different datatypes. I want to convert these dataframe to numpy array. How can I do this for dataframe with same datatype and different dataypes. 

May 12, 2019 in Python by Isha
3,304 views

1 answer to this question.

0 votes

Irrespective of whether the dataframe has similar datatypes or not, you can the below method:

df.to_numpy()
answered May 12, 2019 by Rishi

Related Questions In Python

0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

answered Nov 12, 2018 in Python by Nymeria
• 3,520 points
10,852 views
0 votes
1 answer

How to convert multiple columns to string in pandas dataframe?

Hi, To convert multiple columns to string, include a list of ...READ MORE

answered Jul 18, 2019 in Python by Taj
• 1,040 points
1,880 views
0 votes
1 answer
0 votes
1 answer

How to save Numpy array as image in python?

If you have matplotlib, you can do: import ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,520 points
3,421 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, 2019 in Python by Pavan
347 views
0 votes
1 answer
0 votes
1 answer

How to create Pandas series from dictionary?

Here's a sample script: import pandas as pd import ...READ MORE

answered Apr 1, 2019 in Python by Prateek
66 views
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

How to print the index of a Pandas Dataframe?

You can do this using the code ...READ MORE

answered May 12, 2019 in Python by Usha
124 views