Using Python to replace MATLAB: how to import data?

By : clowny
Source: Stackoverflow.com
Question!

I want to use some Python libraries to replace MATLAB. How could I import Excel data in Python (for example using NumPy) to use them?

I don't know if Python is a credible alternative to MATLAB, but I want to try it. Is there a a tutorial?

By : clowny


Answers
1
By : JuanPi


"I don't know if Python is a credible alternative to MATLAB"

For me (experimental physics) Python is not only a full replacement for MATLAB (when including SciPy and Matplotlib as mentioned above), but it is useful for many things other than data crunching and visualisation (such are general programming needs).

"I'm going to try SAGE."

It is worth noting that there are a couple of servers running Sage which offer the notebook environmet (check Try Sage online in http://www.sagemath.org/). This is pretty neat given the fact that all you need it is an Internet browser and access (no installation required).

As for the question as interpreted by Kevin Buchs (in another answer), reading proprietary Excel to Python can be done in several methods, some are platform (OS) dependent:

  1. A nice resource (platform independent) - http://www.python-excel.org/
  2. An example using xlrd which I once found useful (this is what I used when I needed it): http://code.activestate.com/recipes/483742/ for an example based on xlrd (platform independent)
  3. pyexcelerator is another option.

I hope this helps. If not, I can try to arrange some example code myself (though the ones I have are over six years old...). I personally prefer, as was proposed in the other answers, to use the CSV or ASCII format.

By : eldad-a


I had a look at mlabwrap as a step to easing some MATLAB developers into using Python more.

But I have been unable to cleanly build it, and I don't run production installs here, so I'm dead in the water.



This video can help you solving your question :)
By: admin