Generate Egyptian realistic datasets in Python for testing & simulating the customer base.
Suppose you need to generate Egyptian realistic datasets with 100,000 rows to simulate the customer base so it will be complicated because the lack of Egyptian data... Therefore this tool will help you.
(All data are uniform distributed & You can make it related to each other e.g governorat and national id)
The specification:
- address
- governorat ("Giza")
- zip_code (12551)
- address ("54 El cooperation / Urban eastern m .Shortly")
- post_office ("Urban East")
- latitude (30.0130557)
- longitude (31.2088526)
- name
- first_name (Mahmoud)
- last_name (Ahmed)
- full_name (Mahmoud Ahmed)
- user_name (mahmoud_ahmed_0)
- NationalID
- generate (2541119632960)
- PhoneNumber
- dialing_code (+20)
- provider (Vodafone)
- phone_number (01014856695)
- intl_phone_number (+201014856695)
- date
- between (1997-12-8)
- recent (1997-12-8)
- dateTime
- between (1997-12-8 11:03)
- recent (1997-12-8 11:03)
- recentUnixTime (1606251876)
- finance
- visa13CreditCardNumber
- visa16CreditCardNumber
- mastercardCreditCardNumber
- helpers
- intBetween
- oneChoice
- replaceSymbolWithNumber
from egyptian_data_generator import *
import pymysql
egyDataGen = EgyptianDataGenerator()
db = pymysql.connect("localhost", "username", "password", "database_name")
cursor = db.cursor()
for i in range(1, 100000):
phoneNumber = egyDataGen.phoneNumber.generate()["intl_phone_number"]
name = egyDataGen.name.generate()
firstName = name["first_name"]
lastName = name["last_name"]
gender = name["gender"]
dateOfBirth = egyDataGen.date.between()
sql = "INSERT INTO users(phone_number, first_name, last_name, gender, date_of_birth, user_type) \
VALUES ('%s', '%s', '%s', '%s', '%s','%d' )" % \
(phoneNumber, firstName, lastName, gender, dateOfBirth, 1)
try:
cursor.execute(sql)
db.commit()
except:
db.rollback()
db.close()
Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Mahmoud Ahmed - Twitter @1243Mahmoud - mahmoud_ahmed@stud.fci-cu.edu.eg
Project Link: https://github.com/mahmoudahmedd/Egyptian-Data-Generator