(n, item_size, pct_null=0, dictionary=None)
| 4170 | |
| 4171 | |
| 4172 | def random_strings(n, item_size, pct_null=0, dictionary=None): |
| 4173 | if dictionary is not None: |
| 4174 | result = dictionary[np.random.randint(0, len(dictionary), size=n)] |
| 4175 | else: |
| 4176 | result = np.array([random_ascii(item_size) for i in range(n)], |
| 4177 | dtype=object) |
| 4178 | |
| 4179 | if pct_null > 0: |
| 4180 | result[np.random.rand(n) < pct_null] = None |
| 4181 | |
| 4182 | return result |
| 4183 | |
| 4184 | |
| 4185 | def test_variable_dictionary_to_pandas(): |
no test coverage detected