“np.to_csv” Kode Jawaban

Simpan array numpy ke CSV

import pandas as pd 
pd.DataFrame(np_array).to_csv("path/to/file.csv")
Bad Barracuda

CSV ke Numpy Array

from numpy import genfromtxt
my_data = genfromtxt('my_file.csv', delimiter=',')
Shiny Salmon

np.to_csv

import numpy
a = numpy.asarray([ [1,2,3], [4,5,6], [7,8,9] ])
numpy.savetxt("foo.csv", a, delimiter=",")
happy penguin

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya