{"id":20982420,"url":"https://github.com/juliaaplavin/skipper.jl","last_synced_at":"2025-03-13T10:26:25.615Z","repository":{"id":238906071,"uuid":"759482464","full_name":"JuliaAPlavin/Skipper.jl","owner":"JuliaAPlavin","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-20T13:40:12.000Z","size":25,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T00:37:29.744Z","etag":null,"topics":["data-manipulation","filtering"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaAPlavin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-18T18:00:01.000Z","updated_at":"2025-02-20T13:40:16.000Z","dependencies_parsed_at":"2024-11-19T05:48:31.370Z","dependency_job_id":"8dfc34f1-1592-448e-b2c2-e79b6fdfab38","html_url":"https://github.com/JuliaAPlavin/Skipper.jl","commit_stats":null,"previous_names":["juliaaplavin/skipper.jl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSkipper.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSkipper.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSkipper.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSkipper.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaAPlavin","download_url":"https://codeload.github.com/JuliaAPlavin/Skipper.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243384955,"owners_count":20282468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-manipulation","filtering"],"created_at":"2024-11-19T05:45:32.198Z","updated_at":"2025-03-13T10:26:25.594Z","avatar_url":"https://github.com/JuliaAPlavin.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Skipper.jl\n\n`skip(predicate, collection)`: extension of `skipmissing` that\n- allows arbitrary predicates, such as `ismissing`, `isnan` or `x -\u003e isnan(x) || iszero(x)`\n- supports setting values\n\nAlternatively, use `keep(predicate, collection)` when it is more natural to define what items to keep: for example, `keep(\u003e(0), X)` instead of `skip(x -\u003e isnan(x) || x \u003c 0, X)`.\n\n# Usage\n\n```julia\njulia\u003e using Skipper\n\njulia\u003e a = [missing, -1, 2, NaN, 3]\n5-element Vector{Union{Missing, Float64}}:\n    missing\n  -1.0\n   2.0\n NaN\n   3.0\n\n# skip all missing and NaN values\njulia\u003e sa = skip(x -\u003e ismissing(x) || isnan(x), a)\nskip(var\"#5#6\"(), Union{Missing, Float64}[missing, -1.0, 2.0, NaN, 3.0])\n\n# only floats remain\njulia\u003e eltype(sa)\nFloat64\n\n# and only those that are not NaNs\njulia\u003e collect(sa)\n3-element Vector{Float64}:\n -1.0\n  2.0\n  3.0\n\n# indexing works when the target value is valid\njulia\u003e sa[2]\n-1.0\n\n# but errors when it's not\njulia\u003e sa[1]\nERROR: MissingException: the value at index (1,) is skipped\nStacktrace:\n [1] getindex(s::Skipper.Skip{var\"#5#6\", Vector{Union{Missing, Float64}}}, I::Int64)\n   @ Skipper ~/.julia/dev/Skipper/src/Skipper.jl:27\n [2] top-level scope\n   @ REPL[8]:1\n\n# broadcasting and aggregations work just fine with skip() objects\njulia\u003e sa .* 2\n3-element Vector{Float64}:\n -2.0\n  4.0\n  6.0\n\njulia\u003e using Statistics\njulia\u003e mean(sa)\n1.3333333333333333\n\n# skip() objects support setindex!\n# this makes transforming valid (non-skipped) elements easy:\njulia\u003e sa .= ifelse.(sa .\u003e 2, 3, 1)\njulia\u003e a\n5-element Vector{Union{Missing, Float64}}:\n    missing\n   1.0\n   1.0\n NaN\n   3.0\n\n# as well as replacing/imputing skipped values:\njulia\u003e Skipper.complement(sa) .= mean(sa);\njulia\u003e a\n5-element Vector{Union{Missing, Float64}}:\n 1.6666666666666667\n 1.0\n 1.0\n 1.6666666666666667\n 3.0\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaaplavin%2Fskipper.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaaplavin%2Fskipper.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaaplavin%2Fskipper.jl/lists"}