Python - convert multidimensional NumPy array & into a csv

Hi,

It it possible to put a multidimensional NumPy array & into a csv?
Is there any way to do it?

Thanks in advance.

Yep.
Save the array as a data frame:

df = pd.DataFrame(arr)

then you can save the df as a csv file using:

df.to_csv('filename.csv')

See here:
https://pythonguides.com/python-write-array-to-csv/
or here:
https://www.geeksforgeeks.org/convert-a-numpy-array-into-a-csv-file/

1 Like

Hi @lisalisaj,

Thanks for replying & providing solution :slight_smile:

1 Like