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

Method generate_float_list

python/benchmarks/common.py:135–145  ·  view source on GitHub ↗

Generate a list of Python floats with *none_prob* probability of an entry being None (or NaN if *use_nan* is true).

(self, n, none_prob=DEFAULT_NONE_PROB,
                            use_nan=False)

Source from the content-addressed store, hash-verified

133 return data
134
135 def generate_float_list(self, n, none_prob=DEFAULT_NONE_PROB,
136 use_nan=False):
137 """
138 Generate a list of Python floats with *none_prob* probability of
139 an entry being None (or NaN if *use_nan* is true).
140 """
141 # Make sure we get Python floats, not np.float64
142 data = list(map(float, self.rnd.uniform(0.0, 1.0, n)))
143 assert len(data) == n
144 self.sprinkle(data, none_prob, value=float('nan') if use_nan else None)
145 return data
146
147 def generate_bool_list(self, n, none_prob=DEFAULT_NONE_PROB):
148 """

Callers 2

setupMethod · 0.95
generate_dict_listMethod · 0.95

Calls 4

sprinkleMethod · 0.95
listFunction · 0.85
mapFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected