Skip to content

Standardizing where the target column goes in transform, insertcols and constructors #2084

Closed
@pdeffebach

Description

@pdeffebach

This issue is for discussion about standardizing the following syntaxes for creating new columns in data frames. We currently have two approaches, the symbol goes first or it goes second.

Constructor: df = DataFrame(:a => [1, 2], :b => [5, 6]). This syntax is currently only possible as the Pair version of syntax for keyword arguments.

insertcols!: This woks like a constructor, insertcols!(df, 3, :c => ["a", "b"]). This is not implemented only through standard keyword argyment syntax but rather through an actual Pair{Symbol, <:Any} method.

Future transform. After discussions in #1975, we have settled on having transform(df, :b => f => :d). Notice here that :d is at the end of this command, indicating "at the end of this operation, we create it all goes into a new column :d".

There is an inconsistency here. With insertcols, :b => v isn't putting v in the column :b the same way the transform syntax works.

I think we should standardize around having a Symbol at the end. But this makes a lot of complications. For instance, we might need to get rid of keyword arguments in the constructor, otherwise :b => v would be valid syntax due to default Julia syntax.

Consequently I think the issue merits discussion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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