Skip to content

[Python] pyarrow.compute.utf8_center disagrees with str.center when number of needed padding characters is odd #15053

@mroeschke

Description

@mroeschke

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

In [1]: import pyarrow as pa; import pyarrow.compute as pc

In [2]: pa.__version__
Out[2]: '10.0.1'

In [3]: s = "bb"

In [4]: s.center(5, "X")
Out[4]: 'XXbbX'

In [5]: pc.utf8_center(pa.scalar(s), 5, padding="X")
Out[5]: <pyarrow.StringScalar: 'XbbXX'>

I suppose in theory it's arbitrary where the two XX are added (front or back) to center the string, but I would expect to match the standard library behavior for consistency

Component(s)

Python

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions