Convert csv file to NumPy array

0 votes
How do I convert a csv file to a NumPy array?
May 24 in Python by Lina
17 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hi @Lina, 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.

answered May 24 by Puneet

Related Questions In Python

0 votes
1 answer

Python convert excel file to csv

Here you go: import glob path_to_excel_files = glob.glob('path/to/excel/files/*.xlsx') for ...READ MORE

answered Feb 8 in Python by Omkar
• 67,000 points
30 views
0 votes
1 answer

Python convert extracted excel file to csv

Try the following script: import pandas as pd import ...READ MORE

answered Feb 8 in Python by Omkar
• 67,000 points
112 views
0 votes
1 answer

Python convert XLS and XLSX file to csv

You can't convert the files with both ...READ MORE

answered Feb 8 in Python by Omkar
• 67,000 points
1,009 views
0 votes
1 answer

How to convert pandas dataframe to numpy array?

Irrespective of whether the dataframe has similar ...READ MORE

answered May 12 in Python by Rishi
178 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
69 views
+4 votes
6 answers
0 votes
1 answer

How to convert string in Pandas Series to lower case?

Suppose you have the series stored in ...READ MORE

answered May 13 in Python by Raj
25 views
0 votes
1 answer

How do I turn a list into numpy array?

Use this line: numpy_array = np.array(list) And printing/displaying the ...READ MORE

answered May 24 in Python by Isha
12 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.