Reputation: 159
I am using jupyter notebook. I have 3 jupyter source files written in python in a folder in the same directory: parser, preprocess, and temp. I am trying to import parser and import preprocess in the temp file so that I can use the methods written in those files. Example: there is method named extract in parser file. I want to use that from temp file. How can I do that?
Upvotes: 5
Views: 1384
Reputation: 60
The easiest way is to change the files you need to import as py files. As an example, parser.ipynb can be converted to a python file parser.py, and you can import it from another notebook file. If you want to use a function named extract() from parser.py, just import
from parser import extract
Upvotes: 2
Reputation: 1562
You can run pip install preprocess
from the terminal (or CMD, if you are using Windows). Alternatively, you can run ! pip install preprocess
from Jupyter Notebook itself, which will do the same thing. You may need the second one if you are working on Google Colab.
Upvotes: 0
Reputation: 365
You can use pip for installing packages. Open command propmpt (cmd) and type this below command
pip install preprocess
Upvotes: 1