Skip to content

Instantly share code, notes, and snippets.

@ogrisel
Created November 13, 2024 17:36
Show Gist options
  • Save ogrisel/50f2a29b14b9ebea503bab8a42ddbb9a to your computer and use it in GitHub Desktop.
Save ogrisel/50f2a29b14b9ebea503bab8a42ddbb9a to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"kernelspec": {
"name": "python",
"display_name": "Python (Pyodide)",
"language": "python"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8"
}
},
"nbformat_minor": 4,
"nbformat": 4,
"cells": [
{
"cell_type": "code",
"source": "import time\nimport pathlib\n\nif \"kernel_timestamp\" not in locals():\n kernel_timestamp = int(time.time() * 1_000)\n log_file = pathlib.Path(\n f\"kernel_log_{kernel_timestamp}.txt\")\n log_file.write_text(\"kernel started\\n\")\n\n\nprint(f\"Kernel started with timestamp {kernel_timestamp} and session successfully connected.\")",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": "tic = time.time()\nimport pandas as pd\ntoc = time.time()\n\nprint(pd.__version__)\n\nimport_duration = toc - tic\nlog_file.write_text(f\"imported libraries in {import_duration:.1f} s\\n\")",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": "",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment