Updated: 18 December 2023
Key bindings
Command Palette | Ctrl + Shift + c |
Run a cell | Ctrl + Enter |
Run cell and advance to next | Shift + Enter |
Insert cell above | A |
Insert cell below | B |
Change cell type to code | y |
Change cell type to markdown | m |
Edit a cell | Enter |
Save notebook | Ctrl + S |
Delete cell | dd |
Docker
https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html#example-2
docker run -it --rm -p 8888:8888 -v "${PWD}":/home/jovyan/work jupyter/datascience-notebook:2023-08-19
MySQL
Query MySQL database from a Jupyter notebook. Minimal working example:
Cell one
! pip install sqlalchemy
! pip install pandas
! pip install mysql-connector-python
Cell two
import sqlalchemy
import pandas as pd
url = 'mysql+mysqlconnector://the_usr:somepass@172.17.0.1:3307/db_name'
engine = sqlalchemy.create_engine(url)
sql = '''
SELECT * FROM clients;
'''
from sqlalchemy.sql import text
with engine.connect() as conn:
query = conn.execute(text(sql))
df = pd.DataFrame(query.fetchall())
df