error in loading data into the code

N

nakisa

hello , I have started python last week,so maybe my question is a bit
stupid.
I got this error in my simple python code while trying to load data
into the code. I have added this libaraies
from pylab import *
from scipy import *
import matplotlib.mlab as mlab
from numpy import *
from scipy import optimize

but get this following error :

/usr/lib/pymodules/python2.6/matplotlib/mlab.py:1267:
DeprecationWarning: use numpy.loadtxt
warnings.warn("use numpy.loadtxt", DeprecationWarning) # 2009/06/13

any idea ?

thanks,Nakisa
 
D

Diez B. Roggisch

nakisa said:
hello , I have started python last week,so maybe my question is a bit
stupid.
I got this error in my simple python code while trying to load data
into the code. I have added this libaraies
from pylab import *
from scipy import *
import matplotlib.mlab as mlab
from numpy import *
from scipy import optimize

but get this following error :

/usr/lib/pymodules/python2.6/matplotlib/mlab.py:1267:
DeprecationWarning: use numpy.loadtxt
warnings.warn("use numpy.loadtxt", DeprecationWarning) # 2009/06/13

any idea ?

You don't get an error. You get a warning. Crucial difference there. You
can ignore it. You can even suppress it. But you shouldn't bother, the
authors of mlab should.

Diez
 
N

nakisa

thanks Diez :)



You don't get an error. You get a warning. Crucial difference there. You
can ignore it. You can even suppress it. But you shouldn't bother, the
authors of mlab should.

Diez
 
P

Peter Otten

This is idiomatically written as

from matplotlib import mlab

When you (nakisa) use *-imports on large beasts like pylab and scipy you are
likely to encounter name clashes. The behaviour of your program becomes
dependent on the order of imports, and for every name in pylab that you want
to use you have to verify that there isn't an object of the same name in
scipy or numpy. I'd say this is more hassle than the few characters you save
are worth.
You don't get an error. You get a warning. Crucial difference there. You
can ignore it. You can even suppress it. But you shouldn't bother, the
authors of mlab should.

.... unless you are invoking matplotlib.mlab.load() in the code you wrote
yourself. In this case follow the advice in the warning and replace it with
numpy.loadtxt().

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top