Created
April 4, 2019 02:03
-
-
Save randName/ebb80e63bba01d47db8b333804b3c702 to your computer and use it in GitHub Desktop.
Colaboratory Template
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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "template.ipynb", | |
"version": "0.3.2", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"accelerator": "GPU" | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/randName/ebb80e63bba01d47db8b333804b3c702/template.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "FpLGYMZl3MzW", | |
"colab_type": "text" | |
}, | |
"cell_type": "markdown", | |
"source": [ | |
"## Imports and Utilities" | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "54CRQl-uTMfB", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"#@title Load Google Drive (on new instance) { display-mode: \"form\" }\n", | |
"MOUNT_POINT = '/mnt/gdrive' #@param {type:\"string\"}\n", | |
"DRIVE_PATH = '' #@param {type:\"string\"}\n", | |
"PROJECT_DIR = 'data' #@param {type:\"string\"}\n", | |
"ln_path = '%s/My\\ Drive/%s' % (MOUNT_POINT, DRIVE_PATH)\n", | |
"\n", | |
"directories = !ls -l\n", | |
"\n", | |
"if directories.grep(PROJECT_DIR):\n", | |
" print('%s already loaded' % PROJECT_DIR)\n", | |
"else:\n", | |
" from google.colab import drive\n", | |
" drive.mount(MOUNT_POINT)\n", | |
" !ln -s $ln_path $PROJECT_DIR" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"colab_type": "code", | |
"cellView": "form", | |
"id": "9J8bYU6OC86K", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"#@title Core\n", | |
"\n", | |
"%matplotlib inline\n", | |
"\n", | |
"import numpy as np\n", | |
"import pandas as pd\n", | |
"import matplotlib.pyplot as plt\n", | |
"\n", | |
"\n", | |
"class AttrDict(dict):\n", | |
" \"\"\"Convenience class\"\"\"\n", | |
" __getattr__ = dict.__getitem__\n", | |
" __setattr__ = dict.__setitem__\n", | |
" __delattr__ = dict.__delitem__\n", | |
"\n", | |
"\n", | |
"def show_preview(data, run):\n", | |
" return run(data) if data is not None else 'No data selected'" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"id": "fW3q9rV0DMPw", | |
"colab_type": "text" | |
}, | |
"cell_type": "markdown", | |
"source": [ | |
"## `[Actual Project]`" | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "Ce2VvARrDUWQ", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment