From 1697491f2633e49d150d8e3d6d624d90be9951aa Mon Sep 17 00:00:00 2001 From: Jean Chang Date: Thu, 3 Oct 2024 17:38:49 -0400 Subject: [PATCH] remediate Ep10 plotting issue include wget workaround --- episodes/data-visualisation.md | 31 +++++++++++++++++++++++++++++-- episodes/looping-data-sets.md | 17 ++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/episodes/data-visualisation.md b/episodes/data-visualisation.md index 5aca9f7..c333aea 100644 --- a/episodes/data-visualisation.md +++ b/episodes/data-visualisation.md @@ -20,7 +20,7 @@ exercises: 10 :::::::::::::::::::::::::::::::::::::::::: spoiler -## Setup instructions this session does not include Episode 7 +## Setup instructions if your Google Drive is not mounted You'll need to load the library `pandas` and make your google drive accessible: ```python @@ -30,13 +30,40 @@ drive.mount('/content/drive') file_location = "drive/MyDrive/lc-python/" ``` You'll need to grant Google all the permissions it requests to make your google drive accessible to Colab. +:::::::::::::::::::::::::::::::::::::::::: spoiler + +### What if the files have not been copied to my Google Drive yet? + +We wanted you to know how to make files you have on your computer accessible for use in Colab and persist over time. To save time now, run `wget` to download files directly to the cloud: + +```bash +!wget https://github.com/jlchang/cb-python-intro-lesson-template/raw/refs/heads/main/episodes/files/data.zip +!unzip data.zip +``` +```python +file_location = "" +``` +:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::: For this module, we will use the tidy (long) version of our circulation data, where each variable forms a column, each observation forms a row, and each type of observation unit forms a row. If your workshop included the Tidy Data episode, you should be set and have an object called `df_long` in your Jupyter environment. If not, we’ll read that dataset in now, as it was provided for this lesson. +:::::::::::::::::::::::::::::::::::::::::: spoiler +## What version of `pandas` is Colab using? + +We can find out the version number of installed Python libraries with +```bash +!pip list +``` +The output will be extensive but is sorted alphabetically. Look for the version number for `pandas`. If it is `2.2.2`, you'll need to: +```bash +!pip install pandas==2.3.3 +``` +there's a plotting bug in version `2.2.2`. +:::::::::::::::::::::::::::::::::::::::::::::::::: ``` python -#import if it is already not +#import if pandas is not already loaded import pandas as pd df_long = pd.read_pickle(file_location + 'data/df_long.pkl') ``` diff --git a/episodes/looping-data-sets.md b/episodes/looping-data-sets.md index d68f43d..ae54421 100644 --- a/episodes/looping-data-sets.md +++ b/episodes/looping-data-sets.md @@ -21,7 +21,7 @@ exercises: 10 :::::::::::::::::::::::::::::::::::::::::: spoiler -## Setup instructions this session does not include Episode 5 +## Setup instructions if your Google Drive is not mounted You'll need to load the library `pandas` and make your google drive accessible: ```python @@ -31,6 +31,21 @@ drive.mount('/content/drive') file_location = "drive/MyDrive/lc-python/" ``` You'll need to grant Google all the permissions it requests to make your google drive accessible to Colab. + +:::::::::::::::::::::::::::::::::::::::::: spoiler + +### What if the files have not been copied to my Google Drive yet? + +We wanted you to know how to make files you have on your computer accessible for use in Colab and persist over time. To save time now, run `wget` to download files directly to the cloud: + +```bash +!wget https://github.com/jlchang/cb-python-intro-lesson-template/raw/refs/heads/main/episodes/files/data.zip +!unzip data.zip +``` +```python +file_location = "" +``` +:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::: ## Use a `for` loop to process files given a list of their names.