Created
December 20, 2022 09:23
-
-
Save tanjuntao/a17306b1e5ebd45c2515da3204416f0b to your computer and use it in GitHub Desktop.
generate pseudo phone numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import numpy as np | |
import pandas as pd | |
headers = ['134', '135', '136', '137', '138', '139', | |
'147', '150', '151', '152', '157', '158', '159', | |
'165', '172', '178', '182', '183', '184', '187', '188', '189', | |
'130', '131', '132', '145', '155', '156', '166', '171', '175', '176', | |
'185', '186', '133', '149', '153', '173', '177', '180', '181', '189', '199' ] | |
minimum = 0 | |
maximum = 99999999 | |
n_phones = 10000 | |
phones = [] | |
for _ in range(n_phones): | |
head = random.choice(headers) | |
body = random.randint(minimum, maximum) | |
str_body = str(body).zfill(8) | |
phone = head + str_body | |
phones.append(phone) | |
np_phones = np.array(phones).reshape(n_phones, 1) | |
pd_phones = pd.DataFrame(np_phones) | |
pd_phones.to_csv('phones.csv', index=False, header=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment