An easy way to create an import module with jupyter

I wanted to create my own module with jupyter, what should I do? I will leave a solution.

environment

OS : MacOS Catalina 10.15.5 Machine: 1.2 GHz dual core Intel Core m3 Version : Python 3.7.7

Execution method

It was difficult to understand what to do with jupyter because the method that came out when I researched various things, so I made a note of the flow from actually creating it with jupyter and executing it.

procedure

  1. Create the code you want to module
  2. Create a text file with jupyter
  3. Copy the code to a text file.
  4. Change the extension of the text file to .py

Now you have created the module.

For importing your own module, please refer to other people's literature.

References

Modularize and package your own functions with python I'm addicted to importing Python3 self-made modules

Reference code

import sys, os
from pathlib import Path
#Get the path of a parent directory such as signalfunc,This is a writing style peculiar to Jupyter system
current_dir = os.path.join(Path().resolve())
#Add path with module
sys.path.append(str(current_dir) + '/../make_module')
``


Recommended Posts

An easy way to create an import module with jupyter
To import your own module with jupyter
Easy way to customize Python import
Easy to create API server using go-json-rest module
[Small story] Easy way to convert Jupyter to PDF
An easy way to call Java from Python
How to create random numbers with NumPy's random module
Easy way to scrape with python using Google Colab
An easy way to pad the number with zeros depending on the number of digits [Python]
What to do if you get an Import Error when importing matplotlib with Jupyter
Create an environment with virtualenv
Create an API with Django
Easy to make with syntax
[Python] Another way to import
Easy way to rename files
Server management with Jupyter (1) import
It's too easy to use an existing database with Django
How to import NoteBook as a module in Jupyter (IPython)
Minimum Makefile and buildout.cfg to create an environment with buildout
What to do when an error occurs with import _ssl
[Python] An easy way to visualize energy data interactively [plotly.express]
Let's create an external specification that is easy to handle
I'm trying to create an authentication / authorization process with Django
The usual way to add a Kernel with Jupyter Notebook
[Python Kivy] How to create an exe file with pyinstaller
How to import NoteBook as a module in Jupyter (IPython)
I tried to create an article in Wiki.js with SQLAlchemy
An easy way to hit the Amazon Product API in Python
Create an alias for Route53 to CloudFront with the AWS API
Easy way to round off to the nearest whole number with python3
Create folders from '01' to '12' with python
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
Try to create an execution path diff viewer with angr + bingraphvis
Easy Jupyter environment construction with Cloud9
How to create a heatmap with an arbitrary domain in Python
An easy way to re-execute a previously executed command in ipython
I came up with a way to create a 3D model from a photo Part 01 Creating an environment
Easy to install pyspark with conda
Easy to use Jupyter notebook (Python3.5)
Create an age group with pandas
Create an arbitrary machine learning environment with GCP + Docker + Jupyter Lab
Easy to draw graphs with matplotlib
[Python Tutorial] An Easy Introduction to Python
Easy way to enter and execute AtCoder test cases in Jupyter Notebook
[HOW TO] Easy way to debug when generating PDF files with PHP etc.
I want to create an Ubuntu chrome User Profile with Colab only
I get an error with import pandas.
Create an application by classifying with Pygame
Create an image processing viewer with PySimpleGUI
python3 How to install an external module
How to create an NVIDIA Docker environment
I want to blog with Jupyter Notebook
Quickly create an excel file with Python #python
Easy way to use Wikipedia in Python
How to use jupyter notebook with ABCI
Create an update screen with Django Updateview
Tag jump to PyPI module with ctags
Let's make jupyter lab easy to use
[Python] Quickly create an API with Flask
Create an add-in-enabled Excel instance with xlwings
Create an English word app with python