Computational biology PhD researcher. Interested in science, software development, and machine learning. I write about medical research at BioSky.co and contribute content to a variety of additional publications.CVAbout
Almost anyone doing research at some point will have to input or extract data from an Excel spreadsheet. However, it is possible to export an Excel file as a .csv file (comma separated file) and then use Python to grab all the data instantly. The Python csv module makes all this incredibly simple:
import csv column1 =  column2 =  column3 =  openfile = csv.reader(open('data.csv')) for row in openfile: first, second, third = row column1.append(first) column2.append(second) column3.append(third)
This script will open your .csv file, and then use the ‘.next()’ method to create an array of all the lines in your file, which you can parse through with the for loop.
Latest posts by Jack Simpson (see all)
- Fruit flies, honeybees, and alcohol - October 18, 2017
- I’m going to Silicon Valley! - October 15, 2017
- Sometimes working in the biology department is pretty neat - October 10, 2017