Skip to content

Commit

Permalink
apacheGH-37333: [Python] Replace pandas.util.testing.rands with vendo…
Browse files Browse the repository at this point in the history
…red version (apache#42089)

### Rationale for this change

Fixes apache#37333.

### What changes are included in this PR?

- Replaces the calls to `pandas.util.testing.rands` with existing `pyarrow.tests.util.rands`
- Updated benchmarks.rst to remove a mention of the now-deprecated `asv dev` command.

### Are these changes tested?

I tested locally in a freshly-created python venv and a conda environment and the benchmarks run without error.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#37333

Authored-by: Bryce Mecum <[email protected]>
Signed-off-by: Joris Van den Bossche <[email protected]>
  • Loading branch information
amoeba authored Jun 12, 2024
1 parent 832880a commit 383ffe0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/source/python/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ run with `ASV`_. You'll need to install the ``asv`` package first
Running the benchmarks
----------------------

To run the benchmarks for a locally-built Arrow, run ``asv dev`` or
``asv run --python=same``.
To run the benchmarks for a locally-built Arrow, run ``asv run --python=same``.

We use conda environments as part of running the benchmarks. To use the ``asv``
setup, you must set the ``$CONDA_HOME`` environment variable to point to the
Expand Down
1 change: 0 additions & 1 deletion python/benchmarks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import pyarrow as pa


KILOBYTE = 1 << 10
MEGABYTE = KILOBYTE * KILOBYTE

Expand Down
4 changes: 2 additions & 2 deletions python/benchmarks/convert_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import numpy as np
import pandas as pd
import pandas.util.testing as tm

import pyarrow as pa
from pyarrow.tests.util import rands


class PandasConversionsBase(object):
Expand Down Expand Up @@ -60,7 +60,7 @@ class ToPandasStrings(object):

def setup(self, uniqueness, total):
nunique = int(total * uniqueness)
unique_values = [tm.rands(self.string_length) for i in range(nunique)]
unique_values = [rands(self.string_length) for i in range(nunique)]
values = unique_values * (total // nunique)
self.arr = pa.array(values, type=pa.string())
self.table = pa.Table.from_arrays([self.arr], ['f0'])
Expand Down
2 changes: 1 addition & 1 deletion python/benchmarks/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# specific language governing permissions and limitations
# under the License.

from pandas.util.testing import rands
import numpy as np

import pyarrow as pa
try:
import pyarrow.parquet as pq
except ImportError:
pq = None
from pyarrow.tests.util import rands


class ParquetWriteBinary(object):
Expand Down

0 comments on commit 383ffe0

Please sign in to comment.