Skip to content

Programmatic Renames #120

@mrufsvold

Description

@mrufsvold

I'd like to rename columns with a Dictionary or a Function. @rename only allows for static assignment (easily... I still don't fully have my head around interpolation).

Would it be possible to add @rename_with(x) which passes x to DataFrames.rename, where x is interpolated automatically? One small quirk of doing this is that the position of the DataFrame is different for different methods of DataFrames.rename:

rename(df, dict)
# or
rename(f, df)

The later supports do syntax, but it would mean some type detection would need to happen to figure out which method to call with @rename_with.

Edit: As I wrote this, it might make sense to add @select_with(x) which does a similar thing (returns df[ : , x()]).

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