Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get read excel data into an array with python

In the lab that I work in, we process a lot of data produced by a 96 well plate reader. I'm trying to write a script that will perform a few calculations and output a bar graph using matplotlib.

The problem is that the plate reader outputs data into a .xlsx file. I understand that some modules like pandas have a read_excel function, can you explain how I should go about reading the excel file and putting it into a dataframe?

Thanks

Data sample of a 24 well plate (for simplicity):

0.0868  0.0910  0.0912  0.0929  0.1082  0.1350
0.0466  0.0499  0.0367  0.0445  0.0480  0.0615
0.6998  0.8476  0.9605  0.0429  1.1092  0.0644
0.0970  0.0931  0.1090  0.1002  0.1265  0.1455
like image 320
griffinc Avatar asked Feb 27 '15 21:02

griffinc


1 Answers

I'm not exactly sure what you mean when you say array, but if you mean into a matrix, might you be looking for:

import pandas as pd
df = pd.read_excel([path here])
df.as_matrix()

This returns a numpy.ndarray type.

like image 80
fpes Avatar answered Sep 21 '22 02:09

fpes