Skip to content

Commit b90ef8f

Browse files
committed
Dev tools review
1 parent 3376a92 commit b90ef8f

18 files changed

Lines changed: 2558 additions & 1507 deletions

docs/_quarto.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ book:
209209
- part: "Google Colab In-Depth"
210210
chapters:
211211
- notes/dev-tools/google-colab/table-of-contents.qmd
212-
- notes/dev-tools/google-colab/filesystem.ipynb
212+
#- notes/dev-tools/google-colab/filesystem.ipynb
213+
- notes/dev-tools/google-colab/files.qmd
213214
- notes/dev-tools/google-colab/form-inputs.ipynb
214215
- notes/dev-tools/google-colab/notebook-secrets.qmd
215216
- notes/dev-tools/google-colab/advanced-integrations.ipynb
@@ -223,10 +224,12 @@ book:
223224
- notes/python-modules/datetime.qmd
224225
#- notes/python-modules/getpass.ipynb
225226

226-
#- part: "The Programming Environment"
227-
# #href: notes/python-modules/index.qmd
228-
# chapters:
229-
# - notes/python-lang/file-operations.qmd
227+
- part: "The Programming Environment"
228+
#href: notes/python-modules/index.qmd
229+
chapters:
230+
- href: notes/python-modules/os.ipynb
231+
text: "Accessing the Filesystem with the `os` Module"
232+
- notes/python-lang/file-operations.qmd
230233

231234
- part: "Custom Functions In-Depth"
232235
chapters:
@@ -254,7 +257,7 @@ book:
254257
#body-footer: "© Copyright 2024, Your Name Here"
255258

256259
page-footer:
257-
center: "© Copyright 2024 - 2025, Michael J Rossetti"
260+
center: "© Copyright 2025, Michael J Rossetti"
258261

259262

260263
#bibliography: references.bib
71.5 KB
Loading

docs/images/colab-file-upload.png

37.6 KB
Loading
81 KB
Loading

docs/images/colab-form-inputs.png

236 KB
Loading
51.1 KB
Loading
143 KB
Loading

docs/images/pypi-logo.png

98.9 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Files in Google Colab
2+
3+
Let's take a few moments to explore the \"Files\" menu in the Google Colab left sidebar.
4+
5+
We see there are some example files in the \"sample_data\" directory.
6+
7+
![Example files in the Colab filesystem](../../../images/colab-filesystem.png){height=350 fig-align="center"}
8+
9+
## Downloading Files
10+
11+
Observe, it is possible to download files like these from the Colab filesystem to your local machine, by right-clicking on them.
12+
13+
14+
![Downloading files from the Colab filesystem.](../../../images/colab-file-download.png){height=350 fig-align="center"}
15+
16+
## Uploading Files
17+
18+
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).
19+
20+
![Uploading files to the Colab filesystem.](../../../images/colab-file-upload.png){height=350 fig-align="center"}
21+
22+
## Accessing and Manipulating Files
23+
24+
Once we have the files in the Colab filesystem, we can write Python code to access and manipulate them.
25+
26+
+ One way of interacting with the filesystem in Python is by using the capabilities of [the `os` module](../../python-modules/os.ipynb).
27+
28+
+ For reading and writing text (\".txt\") files, we can leverage the `open` function (see [Text File Operations](../../python-lang/file-operations.qmd)).
29+
30+
+ 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)).
31+
32+
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.

0 commit comments

Comments
 (0)