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 in Python by Isha
1,516 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 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
6,803 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 in Python by Taj
• 1,040 points
169 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
1,955 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
135 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to display column names of Pandas Dataframe?

Suppose the name of your dataframe is df, ...READ MORE

answered May 12 in Python by Tony
38 views
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 in Python by Usha
57 views