Skip to content

Commit

Permalink
remediate Ep10 plotting issue
Browse files Browse the repository at this point in the history
include wget workaround
  • Loading branch information
jlchang committed Oct 3, 2024
1 parent d4b1290 commit 1697491
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
31 changes: 29 additions & 2 deletions episodes/data-visualisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
```
Expand Down
17 changes: 16 additions & 1 deletion episodes/looping-data-sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 1697491

Please sign in to comment.