Skip to content

Commit

Permalink
Dev tools review
Browse files Browse the repository at this point in the history
  • Loading branch information
s2t2 committed Jan 7, 2025
1 parent 3376a92 commit b90ef8f
Show file tree
Hide file tree
Showing 18 changed files with 2,558 additions and 1,507 deletions.
15 changes: 9 additions & 6 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ book:
- part: "Google Colab In-Depth"
chapters:
- notes/dev-tools/google-colab/table-of-contents.qmd
- notes/dev-tools/google-colab/filesystem.ipynb
#- notes/dev-tools/google-colab/filesystem.ipynb
- notes/dev-tools/google-colab/files.qmd
- notes/dev-tools/google-colab/form-inputs.ipynb
- notes/dev-tools/google-colab/notebook-secrets.qmd
- notes/dev-tools/google-colab/advanced-integrations.ipynb
Expand All @@ -223,10 +224,12 @@ book:
- notes/python-modules/datetime.qmd
#- notes/python-modules/getpass.ipynb

#- part: "The Programming Environment"
# #href: notes/python-modules/index.qmd
# chapters:
# - notes/python-lang/file-operations.qmd
- part: "The Programming Environment"
#href: notes/python-modules/index.qmd
chapters:
- href: notes/python-modules/os.ipynb
text: "Accessing the Filesystem with the `os` Module"
- notes/python-lang/file-operations.qmd

- part: "Custom Functions In-Depth"
chapters:
Expand Down Expand Up @@ -254,7 +257,7 @@ book:
#body-footer: "© Copyright 2024, Your Name Here"

page-footer:
center: "© Copyright 2024 - 2025, Michael J Rossetti"
center: "© Copyright 2025, Michael J Rossetti"


#bibliography: references.bib
Expand Down
Binary file added docs/images/colab-file-download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/colab-file-upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/colab-form-dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/colab-form-inputs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/frustration-with-computers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/jupyter-widgets-dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pypi-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions docs/notes/dev-tools/google-colab/files.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Files in Google Colab

Let's take a few moments to explore the \"Files\" menu in the Google Colab left sidebar.

We see there are some example files in the \"sample_data\" directory.

![Example files in the Colab filesystem](../../../images/colab-filesystem.png){height=350 fig-align="center"}

## Downloading Files

Observe, it is possible to download files like these from the Colab filesystem to your local machine, by right-clicking on them.


![Downloading files from the Colab filesystem.](../../../images/colab-file-download.png){height=350 fig-align="center"}

## Uploading Files

And it is possible to upload files from your local machine to the Colab filesystem as well, using the "Files > Upload to session storage" menu option (i.e. the button with the file upload icon).

![Uploading files to the Colab filesystem.](../../../images/colab-file-upload.png){height=350 fig-align="center"}

## Accessing and Manipulating Files

Once we have the files in the Colab filesystem, we can write Python code to access and manipulate them.

+ One way of interacting with the filesystem in Python is by using the capabilities of [the `os` module](../../python-modules/os.ipynb).

+ For reading and writing text (\".txt\") files, we can leverage the `open` function (see [Text File Operations](../../python-lang/file-operations.qmd)).

+ For reading and writing tabular data (\".csv\") files, we can leverage the `pandas` package (see [Getting Started with Pandas](https://prof-rossetti.github.io/applied-data-science-python-book/notes/pandas/obtaining-dataframes.html)).

Some of these examples might seem a bit complicated at the moment for beginners. For now, the main take-away is understanding there are ways for us to write Python code to interact with the surrounding environment, specifically accessing and manipulating the filesystem.
Loading

0 comments on commit b90ef8f

Please sign in to comment.