(n, item_size, pct_null=0, dictionary=None)
| 4190 | |
| 4191 | |
| 4192 | def random_strings(n, item_size, pct_null=0, dictionary=None): |
| 4193 | if dictionary is not None: |
| 4194 | result = dictionary[np.random.randint(0, len(dictionary), size=n)] |
| 4195 | else: |
| 4196 | result = np.array([random_ascii(item_size) for i in range(n)], |
| 4197 | dtype=object) |
| 4198 | |
| 4199 | if pct_null > 0: |
| 4200 | result[np.random.rand(n) < pct_null] = None |
| 4201 | |
| 4202 | return result |
| 4203 | |
| 4204 | |
| 4205 | def test_variable_dictionary_to_pandas(): |
no test coverage detected