4/16/2023

example source code of python for converting numpy ndarray to pandas dataframe

 refer to code:



.

import numpy as np
import pandas as pd

# Create a numpy ndarray
array = np.random.rand(5, 3)
print('array: \n', array)

# Convert the numpy ndarray to a pandas DataFrame
df = pd.DataFrame(array, columns=['Column1', 'Column2', 'Column3'])

# Print the DataFrame
print('df: \n',df)

..



Thank you.

www.marearts.com

πŸ™‡πŸ»‍♂️

No comments:

Post a Comment