Last active
December 16, 2019 12:09
-
-
Save psychemedia/14272d065a5e5246acd648868e5599f5 to your computer and use it in GitHub Desktop.
First fumblings of a sketch around profiling a Jupyter notebook as a text, looking at text readability metrics, code complexity metrics, etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Test Notebook for Notebook Profiler\n", | |
"\n", | |
"This notebook provides a test case for the notebook profiler.\n", | |
"\n", | |
"It includes a range of markdown and code cells intended to test various features of the profiler.\n", | |
"\n", | |
"Note that this notebook does not necessarily run..." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Markdown Cells With Code Blocks\n", | |
"\n", | |
"This cell, for example, contains a single code block:\n", | |
" \n", | |
"```python\n", | |
"import pandas\n", | |
"\n", | |
"#Create a dataframe\n", | |
"df = pd.DataFrame()\n", | |
"```" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This cell contains two code blocks.\n", | |
"\n", | |
"Here's one:\n", | |
"\n", | |
"```python\n", | |
"import pandas\n", | |
"\n", | |
"#Create a dataframe\n", | |
"df = pd.DataFrame()\n", | |
"```\n", | |
"\n", | |
"and here's another:\n", | |
"\n", | |
"```python\n", | |
"import pandas\n", | |
"\n", | |
"#Create a dataframe\n", | |
"df = pd.DataFrame()\n", | |
"```\n", | |
"\n", | |
"So that's two..." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# This is a code cell\n", | |
"import pandas\n", | |
"\n", | |
"#Create a dataframe\n", | |
"df = pd.DataFrame()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# This is a code cell with a magic...\n", | |
"\n", | |
"%matplotlib inline\n", | |
"import time\n", | |
"\n", | |
"def fn():\n", | |
" \"\"\"How is the docstring handled?\"\"\"\n", | |
" pass" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%load_ext sql" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%%sql\n", | |
"SELECT * FROM TABLE;\n", | |
"-- comment just anyway..." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#Here's a cell with a shell command\n", | |
"!ls" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment