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)
| 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 | """ |