Answers for "datafram to numpy"

0

convert a pandas df to a numpy array

x = df.to_numpy()
x
Posted by: Guest on August-02-2021
0

convert numpy array to dataframe

import numpy as np
import pandas as pd

my_array = np.array([[11,22,33],[44,55,66]])

df = pd.DataFrame(my_array, columns = ['Column_A','Column_B','Column_C'])

print(df)
print(type(df))
Posted by: Guest on November-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language