Skip to content

BUG: rank is not supported for double[pyarrow] dtype #51996

Closed
@dylan-lee94

Description

@dylan-lee94

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import numpy as np
pd.options.mode.dtype_backend = 'pyarrow'

df = pd.DataFrame({
    'tags': pd.Series([1,1,1,2,2,2,3,3,3,4,4,4,5,5,5],dtype='int64[pyarrow]'),
    'value': pd.Series(np.random.rand(15),dtype='double[pyarrow]')
    })

result = df['value'].rank()
result = df.groupby('tags')['value'].rank()

Issue Description

When grouping a dataframe and applying the rank function on a column with data type double[pyarrow] I get the following error:
TypeError: rank is not supported for double[pyarrow] dtype

However, applying the rank function without groupby works. This leads me to believe that the error message is misleading and that in fact the rank function does support data type double[pyarrow].

Expected Behavior

The rank function works in combination with groupby for data type double[pyarrow].

Installed Versions

Replace this line with the output of pd.show_versions()

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