Jupyter Notebook
Umfassende Jupyter Notebook verkürzt und Workflows für Datenwissenschaft und interaktives Computing.
Hauptnavigation
| | Shortcut | Mode | Description | |
| --- | --- | --- |
| | Enter
| Command | Enter Edit Mode | |
| | Esc
| Edit | Enter Command Mode | |
| | Shift+Enter
| Both | Run Cell and Select Below | |
| | Ctrl+Enter
| Both | Run Cell | |
| | Alt+Enter
| Both | Run Cell and Insert Below | |
| | ↑/↓
| Command | Select Cell Above/Below | |
| | A
| Command | Insert Cell Above | |
| | B
| Command | Insert Cell Below | |
| | X
| Command | Cut Cell | |
| | C
| Command | Copy Cell | |
| | V
| Command | Paste Cell Below | |
| | Shift+V
| Command | Paste Cell Above | |
| | DD
| Command | Delete Cell | |
| | Z
| Command | Undo Cell Deletion | |
Stammzellen
| | Shortcut | Mode | Description | |
| --- | --- | --- |
| | M
| Command | Change to Markdown Cell | |
| | Y
| Command | Change to Code Cell | |
| | R
| Command | Change to Raw Cell | |
| | 1-6
| Command | Change to Heading 1-6 | |
| | Shift+M
| Command | Merge Selected Cells | |
| | Ctrl+Shift+-
| Edit | Split Cell at Cursor | |
| | Shift+J/K
| Command | Extend Selection Below/Above | |
| | Shift+↑/↓
| Command | Extend Selection | |
Code Editing
| | Shortcut | Mode | Description | |
| --- | --- | --- |
| | Tab
| Edit | Code Completion or Indent | |
| | Shift+Tab
| Edit | Tooltip | |
| | Ctrl+]
| Edit | Indent | |
| | Ctrl+[
| Edit | Dedent | |
| | Ctrl+A
| Edit | Select All | |
| | Ctrl+Z
| Edit | Undo | |
| | Ctrl+Shift+Z
| Edit | Redo | |
| | Ctrl+Y
| Edit | Redo | |
| | Ctrl+Home
| Edit | Go to Cell Start | |
| | Ctrl+End
| Edit | Go to Cell End | |
| | Ctrl+Left/Right
| Edit | Go Left/Right One Word | |
| | Ctrl+Backspace
| Edit | Delete Word Before | |
| | Ctrl+Delete
| Edit | Delete Word After | |
Laufkodex
| | Shortcut | Mode | Description | |
| --- | --- | --- |
| | Shift+Enter
| Both | Run Cell, Select Below | |
| | Ctrl+Enter
| Both | Run Cell | |
| | Alt+Enter
| Both | Run Cell, Insert Below | |
| | Ctrl+K
| Command | Interrupt Kernel | |
| | 0,0
| Command | Restart Kernel | |
| | Shift+L
| Command | Toggle Line Numbers | |
| | Shift+O
| Command | Toggle Output | |
Dateioperationen
| | Shortcut | Mode | Description | |
| --- | --- | --- |
| | Ctrl+S
| Both | Save and Checkpoint | |
| | Ctrl+Shift+S
| Command | Save As | |
| | Ctrl+O
| Command | Open | |
| | Ctrl+N
| Command | New Notebook | |
| | Ctrl+Shift+P
| Command | Command Palette | |
Ansicht und Layout
| | Shortcut | Mode | Description | |
| --- | --- | --- |
| | Shift+Space
| Command | Scroll Up | |
| | Space
| Command | Scroll Down | |
| | Ctrl+Shift+L
| Command | Toggle All Line Numbers | |
| | F
| Command | Find and Replace | |
| | O
| Command | Toggle Output | |
| | Shift+O
| Command | Toggle Output Scrolling | |
Magische Befehle
| | Command | Description | |
| --- | --- |
| | %run script.py
| Run Python script | |
| | %load script.py
| Load script into cell | |
| | %who
| List variables | |
| | %whos
| List variables with details | |
| | %time statement
| Time execution of statement | |
| | %timeit statement
| Time execution multiple times | |
| | %matplotlib inline
| Enable inline plots | |
| | %pwd
| Print working directory | |
| | %cd directory
| Change directory | |
| | %ls
| List directory contents | |
| | %history
| Show command history | |
| | %reset
| Reset namespace | |
| | %debug
| Enter debugger | |
| | %pdb on/off
| Toggle automatic debugger | |
Cell Magic Commands
| | Command | Description | |
| --- | --- |
| | %%time
| Time execution of entire cell | |
| | %%timeit
| Time execution of cell multiple times | |
| | %%bash
| Run cell as bash script | |
| | %%html
| Render cell as HTML | |
| | %%javascript
| Run cell as JavaScript | |
| | %%latex
| Render cell as LaTeX | |
| | %%markdown
| Render cell as Markdown | |
| | %%python2
| Run cell with Python 2 | |
| | %%python3
| Run cell with Python 3 | |
| | %%writefile filename
| Write cell contents to file | |
Data Science Workflows
Daten laden und Exploration
```python import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns
Load data
df = pd.read_csv('data.csv')
Quick exploration
df.head() df.info() df.describe() df.shape ```_
Datenvisualisierung
```python
Matplotlib inline
%matplotlib inline
Basic plots
plt.figure(figsize=(10, 6)) plt.plot(x, y) plt.title('Title') plt.xlabel('X Label') plt.ylabel('Y Label') plt.show()
Seaborn plots
sns.scatterplot(data=df, x='col1', y='col2') sns.heatmap(df.corr(), annot=True) ```_
Maschine lernen Pipeline
```python from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error
Prepare data
X = df[['feature1', 'feature2']] y = df['target']
Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
Train model
model = LinearRegression() model.fit(X_train, y_train)
Evaluate
predictions = model.predict(X_test) mse = mean_squared_error(y_test, predictions) ```_
Markdown Formatierung
Kopf
```markdown
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
```_
Textformatierung
markdown
**Bold text**
*Italic text*
`Code text`
~~Strikethrough~~
_
Listen
```markdown - Unordered list item 1 - Unordered list item 2
- Ordered list item 1
- Ordered list item 2 ```_
Links und Bilder
markdown
[Link text](URL)

_
Tabellen
markdown
| | Column 1 | Column 2 | Column 3 | |
| --- | --- | --- |
| | Row 1 | Data | Data | |
| | Row 2 | Data | Data | |
_
Math (LaTeX)
```markdown Inline math: $E = mc^2$
Block math: $\int_\\{-\infty\\}^\\{\infty\\} e^\\{-x^2\\} dx = \sqrt\\{\pi\\}$ ```_
Best Practices
Code Organisation
- sinnvolle Variablennamen verwenden
- Kommentare und Docstrings hinzufügen
- Komplexe Operationen in mehreren Zellen brechen
- Funktionen für wiederholte Operationen verwenden
- Bibliotheken nach oben importieren
Datenanalyse Workflow
- *Datenbelastung: Import und erste Exploration
- ** Datenreinigung**: Zeigen Sie fehlende Werte, Ausreißer
- Datenanalyse : Visualisierungen und Statistiken
- Feature Engineering: Neue Features erstellen
- Modeling: Modelle trainieren und bewerten
- *Ergebnisse: Ergebnisse interpretieren und visualisieren
Leistungsspitzen
- Verwenden Sie vektorisierte Operationen mit NumPy/Pandas
- Vermeiden Sie Schlaufen, wenn möglich
- geeignete Datentypen verwenden
- Klare Ausgabe großer Zellen
- Kernel periodisch wiederfinden
Dokumentation
- Markdown-Zellen für Erläuterungen verwenden
- Annahmen und Entscheidungen von Dokumenten
- Datenquelleninformationen einschließen
- Schlussfolgerungen und nächste Schritte hinzufügen
- Verwenden Sie klare Schnittkopf