Skip to content

[Python] Table.rename_columns should accept tuple #43588

@0x26res

Description

@0x26res

Describe the bug, including details regarding any error messages, version, and platform.

I've been using pyarrow.Table.rename_columns with tuple of str. This means I can store the column names in global variables, and not worry about someone mutating the list of names.

But since pyarrow 17.0.0 it stopped working:

import pyarrow as pa

pa.table(
    {
        "col1": [1, 2, 3],
        "col2": [1, 2, 3],
    }
).rename_columns(("col_1", "col_2"))

Raises:

TypeError: names must be a list or dict not <class 'tuple'>

I think this (welcomed) change introduced it https://github.com/apache/arrow/pull/40645/files

I'm happy to send a fix for it.

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions