Skip to content

[Python] Add a utility function to create Arrow table instead of pandas df #47172

Description

@AlenkaF

Describe the enhancement requested

It would be good to have a utility function to create an Arrow table directly instead of having to go through pandas in some of out pyarrow tests. The existing utility function that uses pandas is:

def _test_dataframe(size=10000, seed=0):
import pandas as pd
np.random.seed(seed)
df = pd.DataFrame({
'uint8': _random_integers(size, np.uint8),
'uint16': _random_integers(size, np.uint16),
'uint32': _random_integers(size, np.uint32),
'uint64': _random_integers(size, np.uint64),
'int8': _random_integers(size, np.int8),
'int16': _random_integers(size, np.int16),
'int32': _random_integers(size, np.int32),
'int64': _random_integers(size, np.int64),
'float32': np.random.randn(size).astype(np.float32),
'float64': np.arange(size, dtype=np.float64),
'bool': np.random.randn(size) > 0,
'strings': [util.rands(10) for i in range(size)],
'all_none': [None] * size,
'all_none_category': [None] * size
})
# TODO(PARQUET-1015)
# df['all_none_category'] = df['all_none_category'].astype('category')
return df

This issue would move some of tests using _test_dataframe to use a new utility function and remove the @pytest.mark.pandas in this cases.

Component(s)

Python

Activity

  1. added theissue type on Jul 23, 2025
  2. egolearner commented on Jul 25, 2025

    @egolearner
    Contributor

    Hi @AlenkaF I'd like to work on this

    /assign

  3. raulcd commented on Jul 25, 2025

    @raulcd
    Member

    Thanks @egolearner , I've assigned the issue as you had commented. You can also send a comment with just the word take in the future and the bot will assign the issue to you.

  4. added a commit that references this issue on Aug 4, 2025
  5. added this to the 22.0.0 milestone on Aug 4, 2025
  6. rok commented on Aug 4, 2025

    @rok
    Member

    Issue resolved by pull request 47199
    #47199

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions