(n, item_size, pct_null=0, dictionary=None)
| 4235 | |
| 4236 | |
| 4237 | def random_strings(n, item_size, pct_null=0, dictionary=None): |
| 4238 | if dictionary is not None: |
| 4239 | result = dictionary[np.random.randint(0, len(dictionary), size=n)] |
| 4240 | else: |
| 4241 | result = np.array([random_ascii(item_size) for i in range(n)], |
| 4242 | dtype=object) |
| 4243 | |
| 4244 | if pct_null > 0: |
| 4245 | result[np.random.rand(n) < pct_null] = None |
| 4246 | |
| 4247 | return result |
| 4248 | |
| 4249 | |
| 4250 | def test_variable_dictionary_to_pandas(): |
no test coverage detected