I created a Jupter Notebook file to work on a project and carry out data analysis on a given dataset. In the notebook, I downloaded/cleaned the data and implemented different regression algorithms. The Jupyter notebook file has become very long (rows) and is now slow to execute / scroll through the document (lag).
I have decided to move the project over to the Spyder IDE. I want to split the python code into different classes to make it easier to run and interpret/understand my code (different functionality in each class).
For example:
- I have a create_dataframe.py file which contains a class to download the dataset and create the dataframe.
- I have a clean_dataframe.py file which contains a class to clean and carry out initial data visualisation.
- Both these classes are imported to the main.py file and called from there.
In all 3 files, I have had to import the pandas/numpy packages.
My question is what is the accepted convention when importing packages in different classes? Is it normal practise to import the same packages in different classes or is there a way to import the packages on the main.py file and then have the package accessible in all other files?