diff --git a/02-attribute-operations.qmd b/02-attribute-operations.qmd index 45775c88..2df0b239 100644 --- a/02-attribute-operations.qmd +++ b/02-attribute-operations.qmd @@ -159,7 +159,7 @@ The standard **numpy** comparison operators (@tbl-comparison-operators) can be u : Comparison operators that return boolean values (`True`/`False`). {#tbl-comparison-operators} -The following example demonstrates logical vectors for subsetting by creating a new `GeoDataFrame` object called `small_countries` that contains only those countries and other teritories from the `world` object whose surface area is smaller than 10,000 $km^2$. +The following example demonstrates logical vectors for subsetting by creating a new `GeoDataFrame` object called `small_countries` that contains only those countries and other territories from the `world` object whose surface area is smaller than 10,000 $km^2$. The first step is to create a logical vector (a `Series` object) that is `True` for countries with an area smaller than 10,000 $km^2$ and `False` otherwise. Then, we use this vector to subset the `world` dataset, which returns a new `GeoDataFrame` object containing only the small countries. @@ -299,7 +299,7 @@ In the following code example, given the `world_agg3` continent summary (@fig-sp - drop the geometry column, - calculate population density of each continent, -- arrange continents by the number countries they contain, and +- arrange continents by the number countries each contains, and - keep only the 3 most populous continents. ```{python} @@ -396,7 +396,7 @@ world2 The resulting `GeoDataFrame` object has a new column called `con_reg` representing the continent and region of each country, e.g., `'South America:Americas'` for Argentina and other South America countries. The opposite operation, splitting one column into multiple columns based on a separator string, is done using the `.str.split` method. -As a result we go back to the previous state of two separate `continent` and `region_un` columns (only that their position is now last, since they are newly created). +As a result, we go back to the previous state of two separate `continent` and `region_un` columns (only that their position is now last, since they are newly created). The `str.split` method returns a column of `list`s by default; to place the strings into separate `str` columns we use the `expand=True` argument. ```{python} @@ -450,7 +450,7 @@ world2 Raster cell values can be considered the counterpart of vector attribute values. In this section, we cover operations that deal with raster values in a similar way, namely as a series of numbers. -This type of operations include subsetting raster values (@sec-raster-subsetting) and calculating global summaries of raster values (@sec-summarizing-raster-objects). +This type of operations includes subsetting raster values (@sec-raster-subsetting) and calculating global summaries of raster values (@sec-summarizing-raster-objects). ### Raster subsetting {#sec-raster-subsetting} @@ -519,7 +519,7 @@ elev1 ``` Now we can insert an `np.nan` value into the array, for example to a cell located in the first row and third column. -(Doing so in the original `elev` array raises an error, because an `int` array cannot accomodate `np.nan`, as mentioned above; try it to see for yourself.) +(Doing so in the original `elev` array raises an error, because an `int` array cannot accommodate `np.nan`, as mentioned above; try it to see for yourself.) ```{python} elev1[0, 2] = np.nan