From 3816beb35613c016fbe8776fd97e38bbd665ba6e Mon Sep 17 00:00:00 2001 From: Sundeep Rangan Date: Tue, 15 Sep 2020 16:37:11 +0200 Subject: [PATCH] Enabled file downloading to run lab in Google colab --- .../lab_robot_calib_partial.ipynb | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/unit03_mult_lin_reg/lab_robot_calib_partial.ipynb b/unit03_mult_lin_reg/lab_robot_calib_partial.ipynb index 7131d9d5..558354ba 100644 --- a/unit03_mult_lin_reg/lab_robot_calib_partial.ipynb +++ b/unit03_mult_lin_reg/lab_robot_calib_partial.ipynb @@ -45,7 +45,42 @@ "* [exp1.csv](./exp1.csv) for training\n", "* [exp2.csv](./exp2.csv) for test\n", "\n", - "Below, I have supplied the column headers in the `names` array. Use the `pd.read_csv` command to load the data. Use the `index_col` option to specify that column 0 (the one with time) is the *index* column. You can review [simple linear regression demo](..\\simp_lin_reg\\auto_mpg.ipynb) for examples of using the `pd.read_csv` command." + "If you are running this notebook on Google colab, you will need to run the following commands to load the files onto your local machine. Otherwise, if you have clone the repository, the files should be in the directory as the notebook and you can skip this step." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "File exp1.csv is already downloaded\n", + "File exp2.csv is already downloaded\n" + ] + } + ], + "source": [ + "import os\n", + "from six.moves import urllib\n", + "\n", + "for fn_dst in ['exp1.csv', 'exp2.csv']:\n", + " fn_src = 'https://raw.githubusercontent.com/sdrangan/introml/master/unit03_mult_lin_reg/%s' % fn_dst\n", + "\n", + " if os.path.isfile(fn_dst):\n", + " print('File %s is already downloaded' % fn_dst)\n", + " else:\n", + " print('Downloaded %s' % fn_dst)\n", + " urllib.request.urlretrieve(fn_src, fn_dst)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Below, I have supplied the column headers in the `names` array. Use the `pd.read_csv` command to load the training data in `exp1.csv`. Use the `index_col` option to specify that column 0 (the one with time) is the *index* column. You can review [simple linear regression demo](..\\simp_lin_reg\\auto_mpg.ipynb) for examples of using the `pd.read_csv` command." ] }, { @@ -253,7 +288,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.7.4" } }, "nbformat": 4,