JuliaData / JuliaData/DataFramesMeta.jl
document the use of `rsubset` to preserve missings
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 496
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
Trying to subset b==0 while still preserving the missing in b
julia> dd = DataFrame(a = [1, 2, 3], b = [1, missing, 0])
3×2 DataFrame
Row │ a b
│ Int64 Int64?
─────┼────────────────
1 │ 1 1
2 │ 2 missing
3 │ 3 0
julia> @chain dd begin
@rsubset :b == 0 | ismissing(:b)
end
1×2 DataFrame
Row │ a b
│ Int64 Int64?
─────┼───────────────
1 │ 3 0
However,
learned on slack that :b == 0 returns missing and the | propagates missing. What we instead should do is
julia> @chain dd begin
@rsubset ismissing(:b) || :b == 0
end
Here the order matters. We would get an error otherwise.
This is a very subtle but important manipulation that it is better to be documented.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the issue's @rsubset examples as the starting point and locate the existing documentation for rsubset. Document why :b == 0 propagates missing, why || is needed, and why the order matters; verify the documented examples produce the intended rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100