Skip to content

Add some sort of Strict option #20

@pdeffebach

Description

@pdeffebach

This issue is motivated by a recent PR to DataFrames here. We would like to add the functionality

julia> df = DataFrame(a = rand(2), b = rand(2));

julia> select(df, Not(:c))
4×2 DataFrame
│ Row │ a        │ b         │
│     │ Float64  │ Float64   │
├─────┼──────────┼───────────┤
│ 1   │ 0.916099 │ 0.0552436 │
│ 2   │ 0.998861 │ 0.310562  │

This currently errors. It would be nice if it didn't error since often you want to drop columns automatically just to "clean things up" and not worry about if the column really exists.

This would create inconsistent behavior with other usage of InvertedIndices, obviously. Indexing columns of a DataFrame would be different than indexing rows in a data frame.

One solution is to have some option in InvertedIndices which would allow the user to specify if they care about selecting things that don't exist in the DataFrame. Perhaps a constructor

Not(:c, strict = false)

Then this is stored in the field somehow so we can specialize behavior based off of this option.

Let me know what you think, It's certainly not the only path to getting the behavior we want but it might be fruitful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions