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

Method make_block_array

asv_bench/benchmarks/sparse.py:144–151  ·  view source on GitHub ↗
(self, length, num_blocks, block_size, fill_value)

Source from the content-addressed store, hash-verified

142 )
143
144 def make_block_array(self, length, num_blocks, block_size, fill_value):
145 arr = np.full(length, fill_value)
146 indices = np.random.choice(
147 np.arange(0, length, block_size), num_blocks, replace=False
148 )
149 for ind in indices:
150 arr[ind : ind + block_size] = np.random.randint(0, 100, block_size)
151 return SparseArray(arr, fill_value=fill_value)
152
153 def time_make_union(self, fill_value):
154 self.arr1.sp_index.make_union(self.arr2.sp_index)

Callers 1

setupMethod · 0.95

Calls 1

SparseArrayClass · 0.90

Tested by

no test coverage detected