MCPcopy Create free account
hub / github.com/apache/arrow / generate_chunks

Function generate_chunks

python/benchmarks/streaming.py:26–37  ·  view source on GitHub ↗
(total_size, nchunks, ncols, dtype=np.dtype('int64'))

Source from the content-addressed store, hash-verified

24
25
26def generate_chunks(total_size, nchunks, ncols, dtype=np.dtype('int64')):
27 rowsize = total_size // nchunks // ncols
28 assert rowsize % dtype.itemsize == 0
29
30 def make_column(col, chunk):
31 return np.frombuffer(common.get_random_bytes(
32 rowsize, seed=col + 997 * chunk)).view(dtype)
33
34 return [pd.DataFrame({
35 'c' + str(col): make_column(col, chunk)
36 for col in range(ncols)})
37 for chunk in range(nchunks)]
38
39
40class StreamReader(object):

Callers 1

setupMethod · 0.85

Calls 2

make_columnFunction · 0.85
dtypeMethod · 0.80

Tested by

no test coverage detected