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 13, 2019 in Python by Isha
6,003 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 13, 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,540 points
30,853 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 19, 2019 in Python by Taj
• 1,080 points
21,349 views
+1 vote
1 answer

How to convert a PIL Image into a numpy array?

Hello @kartik, You just need to convert your ...READ MORE

answered Jun 22, 2020 in Python by Niroj
• 82,880 points
2,211 views
0 votes
1 answer
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
2,197 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
1,449 views
0 votes
1 answer
+1 vote
2 answers

How to display column names of Pandas Dataframe?

print(list(your_df)) READ MORE

answered Jan 18, 2020 in Python by anonymous
20,492 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 13, 2019 in Python by Usha
13,026 views