Skip to content

Commit a109ed5

Browse files
committed
Add note on array-like data types
1 parent bd5aac4 commit a109ed5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

episodes/02-image-basics.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ remotely hosted data.
108108

109109
::::::::::::::::::::::::::::::::::::::::: callout
110110

111-
## Why not use `skimage.io.imread()`
111+
## Why not use `skimage.io.imread()`?
112112

113113
The scikit-image library has its own function to read an image,
114114
so you might be asking why we don't use it here.
@@ -121,6 +121,24 @@ handling metadata.
121121

122122
::::::::::::::::::::::::::::::::::::::::::::::::::
123123

124+
::::::::::::::::::::::::::::::::::::::::: callout
125+
126+
## Beyond NumPy arrays
127+
128+
Beyond NumPy arrays, there exist other types of variables which are array-like. Notably,
129+
[pandas.DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html)
130+
and [xarray.DataArray](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html)
131+
can hold labeled, tabular data.
132+
These are not natively supported in scikit-image, the scientific toolkit we use
133+
in this lesson for processing image data. However, data stored in these types can
134+
be converted to `numpy.ndarray` with certain assumptions
135+
(see `pandas.DataFrame.to_numpy()` and `xarray.DataArray.data`). Particularly,
136+
these conversions ignore the sampling coordinates (`DataFrame.index`,
137+
`DataFrame.columns`, or `DataArray.coords`), which may result in misrepresented data,
138+
for instance, when the original data points are irregularly spaced.
139+
140+
::::::::::::::::::::::::::::::::::::::::::::::::::
141+
124142
## Working with pixels
125143

126144
First, let us add the necessary imports:

0 commit comments

Comments
 (0)