I am new to python and I am running into some troubles importing modules. I have very limited prior knowledge to programming (bit of Fortran and C) and I usually work with Matlab.
I searched the web for import methods and the preferred method according to most tutorials is: import X
If I use the console (iPython respectively) I can execute the following:
import scipy
scipy.stats.cauchy.pdf
However when I use the same line in a function it does not work, I have to use
import scipy.stats as s
s.stats.cauchy.pdf
or I get: AttributeError: 'module' object has no attribute 'stats'
By reading this 'import module' or 'from module import' I got the impression that both should work.
If someone could quickly clear that up for me I would be very thankful!
Best Wishes, Chris