Convert csv file to numpy array

493    Asked by BenPHILLIPS in Salesforce , Asked on Jul 3, 2021

How do I convert a csv file to a NumPy array?

Answered by Chloe Burgess

To convert csv file to numpy array you can use this:

  numpy_array = np.genfromtxt("file.csv", delimiter=";", skip_header=1)

the arguments inside the brackets are the file name, the delimiter, and skip_header set to 1 will make the csv load to an array without the header row.



Your Answer

Interviews

Parent Categories