I have a csv file with around 130 columns and 6000 rows
what is the best way to import them into python, so that I can later use them in a classification algorithm(columns are the labels and rows are individual samples)
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
Use pandas library:
import pandas as pd pd.read_csv('foo.csv')
Pandas identify the headers automatically and is a great tool for data wrangling.
10 Minutes intro to pandas
You can also SFrame. First install graph lab. Then:
import graphlab as gl data = gl.SFrame.read_csv('data.csv')
If you're 'hardcore' you can use python's basic csv reader, but then you will have to write loops to manage the data yourself, so why bother reinvent the wheel, just use pandas or Frame.