MCPcopy
hub / github.com/pandas-dev/pandas / setup

Method setup

asv_bench/benchmarks/strings.py:39–49  ·  view source on GitHub ↗
(self, pd_type, dtype)

Source from the content-addressed store, hash-verified

37 dtype_mapping = {"str": "str", "string[python]": object, "string[pyarrow]": object}
38
39 def setup(self, pd_type, dtype):
40 series_arr = np.array(
41 [str(i) * 10 for i in range(100_000)], dtype=self.dtype_mapping[dtype]
42 )
43 if pd_type == "series":
44 self.arr = series_arr
45 elif pd_type == "frame":
46 self.arr = series_arr.reshape((50_000, 2)).copy()
47 elif pd_type == "categorical_series":
48 # GH37371. Testing construction of string series/frames from ExtensionArrays
49 self.arr = Categorical(series_arr)
50
51 def time_construction(self, pd_type, dtype):
52 self.pd_mapping[pd_type](self.arr, dtype=dtype)

Callers

nothing calls this directly

Calls 4

CategoricalClass · 0.90
arrayMethod · 0.45
copyMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected