Skip to content

Commit

Permalink
small change to filter docstring with multiple conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
drizk1 committed Apr 5, 2024
1 parent 0988568 commit 7d32127
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ Filter rows in a SQL table based on specified conditions.
- `conditions`: Expressions specifying the conditions that rows must satisfy to be included in the output.
Rows for which the expression evaluates to `true` will be included in the result.
Multiple conditions can be combined using logical operators (`&&`, `||`). It will automatically
detect whether the conditions belong in WHERE vs HAVING
detect whether the conditions belong in WHERE vs HAVING.
Temporarily, it is best to use begin and end when filtering multiple conditions. (ex 2 below)
# Examples
```jldoctest
julia> df = DataFrame(id = [string('A' + i ÷ 26, 'A' + i % 26) for i in 0:9],
Expand Down Expand Up @@ -104,14 +106,18 @@ julia> @chain start_query_meta(db, :df_mem) begin
julia> @chain start_query_meta(db, :df_mem) begin
@group_by(groups)
@summarise(mean = mean(percent))
@filter(groups == "bb", mean < .6)
@filter begin
groups == "bb" || # logical operators can still be used like this
mean > .5
end
@collect
end
1×2 DataFrame
2×2 DataFrame
Row │ groups mean
│ String? Float64?
─────┼───────────────────
1 │ bb 0.5
2 │ aa 0.6
```
"""

Expand Down

0 comments on commit 7d32127

Please sign in to comment.