Skip to content

API: allow DataFrame.rename to take a list-like of colums #14829

Open
@chris-b1

Description

@chris-b1

This is closely related to #12392, but I think separate issue. Proposal would be to be able to pass a list-like to DataFrame.rename to make method-chaining easier. I think it would also be consistent with #11980 (Series rename)

df = pd.DataFrame({'a': [1,2], 'b': [3, 4]})

# make this
df = df.rename(columns=['j', 'k'])

# equivalent to 
df.columns = ['j', 'k']

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions