I have in Jupyter Lab functions.py file with function which I wrote which use package statsmodels as sm like below:
def my_fk():
x = sm.Logit()
...
Then I import function from my file in Jupyter Notebook like below and I import needed package statsmodels:
import functions as fck
import statsmodels.api as sm
But when I try to use function imported from my file in Jupyter Notebook like below:
fck.my_fk()
I have an error like follow: NameError: name 'sm' is not defined
My question is:
Where should I import package import statsmodels.api as sm
needed to run my function, so as to be able to use it in Jupyter Notebook ? In Jupyter Notebook or in .py file where I save my function ?
CodePudding user response:
I did on my jupyter cell
!pip install statsmodels
I was able to import statsmodels.api as sm
successfully