Skip to content

Commit bfe387e

Browse files
committed
Add ASVs
1 parent ec21df5 commit bfe387e

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

asv_bench/benchmarks/array.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import pandas as pd
44

5+
from .pandas_vb_common import tm
6+
57

68
class BooleanArray:
79
def setup(self):

asv_bench/benchmarks/strings.py

+15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
from .pandas_vb_common import tm
88

99

10+
class Construction:
11+
12+
params = ["str", "string"]
13+
param_names = ["dtype"]
14+
15+
def setup(self):
16+
self.data = tm.rands_array(nchars=10 ** 5, size=10)
17+
18+
def time_construction(self, dtype):
19+
Series(self.data, dtype=dtype)
20+
21+
def peakmem_construction(self, dtype):
22+
Series(self.data, dtype=dtype)
23+
24+
1025
class Methods:
1126
def setup(self):
1227
self.s = Series(tm.makeStringIndex(10 ** 5))

pandas/_libs/lib.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def astype_intsafe(ndarray[object] arr, new_dtype):
619619
@cython.wraparound(False)
620620
@cython.boundscheck(False)
621621
cpdef ndarray[object] ensure_string_array(
622-
ndarray arr,
622+
arr,
623623
object na_value=np.nan,
624624
bint convert_na_value=True,
625625
bint copy=True,

pandas/core/dtypes/cast.py

-1
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,6 @@ def construct_1d_ndarray_preserving_na(
16101610
"""
16111611

16121612
if dtype is not None and dtype.kind == "U":
1613-
values = np.asarray(values, dtype="object")
16141613
subarr = lib.ensure_string_array(values, convert_na_value=False, copy=copy)
16151614
else:
16161615
subarr = np.array(values, dtype=dtype, copy=copy)

0 commit comments

Comments
 (0)