Skip to content

Commit 3bfea33

Browse files
committed
Update README.md [ci skip]
1 parent fa5ef56 commit 3bfea33

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,17 @@ There are two things you need to specify in order to subset your data with `sele
278278

279279
First argument of the `select:where:` message should be an array of column names. They will not affect the selection of rows, but the resulting data frame will contain only these columns. Second argument should be a block with boolean conditions that will be applied to each row of data frame. Only those rows that make a block return `true` will be selected. In your conditions you will be referencing the features of your observations. For example, in Iris dataset you might want to select those flowers that belong to `#setosa` species and have the width of sepal equal to `3`. To make queries more readable, DataFrame provides a querying language that allows you to specify the columns which you are using in your conditions as arguments of the where-block, and use these arguments in your conditions. So, for example, a block `[ :species | species = #setosa ]` passed to `select:where:` message will be translated to `[ :row | (row atKey: #species) = #setosa ]` and applied to every row of data frame. This means that all the arguments of the block you pass must correspond to the column names of your data frame.
280280

281-
Here is a query that selects `petal_width` and `petal_length` columns, and all the rows that satisfy the condition described above
281+
Here is a query that selects `petal_width` and `petal_length` columns, and all the rows that satisfy the condition described in the previous paragraph
282282

283283
```smalltalk
284284
df select: #(petal_width petal_length)
285285
where: [ :species :sepal_width |
286286
species = #setosa and: sepal_width = 3 ].
287287
```
288+
289+
If you rather want to select all the columns of a data frame, use the `selectAllWhere:` message. It works in a same way as `SELECT * WHERE` in SQL
290+
291+
```smalltalk
292+
df selectAllWhere: [ :species :sepal_width |
293+
species = #setosa and: sepal_width = 3 ].
294+
```

0 commit comments

Comments
 (0)