Skip to content

Commit bc102ad

Browse files
committed
tweak notebook text
1 parent 8866f0b commit bc102ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

04.pandas/pandas.ipynb

+6-6
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
"\n",
128128
"Here, we use an **f-string** to combine the `station` variable (which takes on a value from the `new_stations` **list** on each pass through the loop) with `'data.csv'`, so that the resulting file names will be `'oxforddata.csv'`, `'southamptondata.csv'`, and `'stornowaydata.csv'`. We then use `Path()` to combine this with the `'data'` directory name, so that the value of `fn_data` is the complete relative path to each file.\n",
129129
"\n",
130-
"Next, we use `pd.read_csv()` to read in the file, and add a `station` variable to the table, just like we did with the Armagh data. \n",
130+
"Next, we again use `pd.read_csv()` to read in the file, and add a `station` variable to the table, just like we did with the Armagh data. \n",
131131
"\n",
132132
"Finally, we use `pd.concat()` ([documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.concat.html)) to combine the existing table, `station_data`, with the newly loaded table (`data`), and overwrite the value of `station_data` with this combined table:\n",
133133
"\n",
@@ -136,7 +136,7 @@
136136
"\n",
137137
"```\n",
138138
"\n",
139-
"Each time through the **for** loop, the value of `station` is updated:"
139+
"Remember that each time through the **for** loop, the value of `station` is updated - so on the first time through, the value of `station` will be `'oxford'`, on the second time through it will be `'southampton'`, and on the final time through it will be `'stornoway'`:"
140140
]
141141
},
142142
{
@@ -161,7 +161,7 @@
161161
"id": "325becd3-fb17-48c4-9314-59f225aa8239",
162162
"metadata": {},
163163
"source": [
164-
"Note that this is one advantage of using clear, consistent naming and formatting for data files - we can easily write a loop to load multiple files, instead of having to write individual paths.\n",
164+
"Note that this is one advantage of using **clear, consistent naming and formatting for data files** - it means that we can easily write a loop to load multiple files, instead of having to write individual paths or treat each file differently!\n",
165165
"\n",
166166
"## selecting rows using expressions\n",
167167
"\n",
@@ -185,7 +185,7 @@
185185
"id": "ff430bcf-9e94-4fb6-9931-6b1fde1ef64e",
186186
"metadata": {},
187187
"source": [
188-
"If we want to use multiple conditions - for example, all observations where the monthly maximum temperature is greater than 20°C, and the monthly rainfall is grater than 100 mm, we can't simply use the `&` operator with the two statements:"
188+
"Remember that if we want to use multiple conditions - for example, all observations where the monthly maximum temperature is greater than 20°C, and the monthly rainfall is greater than 100 mm, we can't simply use the `&` operator with the two statements:"
189189
]
190190
},
191191
{
@@ -955,7 +955,7 @@
955955
"metadata": {},
956956
"outputs": [],
957957
"source": [
958-
"sample = station_data \\\n",
958+
"station_data \\\n",
959959
" .groupby('station') \\\n",
960960
" .sample(5)"
961961
]
@@ -1004,7 +1004,7 @@
10041004
"name": "python",
10051005
"nbconvert_exporter": "python",
10061006
"pygments_lexer": "ipython3",
1007-
"version": "3.11.6"
1007+
"version": "3.10.15"
10081008
}
10091009
},
10101010
"nbformat": 4,

0 commit comments

Comments
 (0)