DEV Community

Cover image for Generate 5000 Fake Female names of USA
Sohail Ahmed
Sohail Ahmed

Posted on

Generate 5000 Fake Female names of USA

One of my friend was looking for multiple female names of USA, so his team can create accounts using those names on one of the website!

My friend was manually generating female names of USA using fakenamegenerator.com! That was hectic job for him and time consuming too.

He just contact me so i can generate using any script. I come up with an idea to generate using python library pip install faker, which is one of the best library to generate fake first name, last name, address etc within seconds!

I wrote a code of few lines, which helped him to generate as many names within a second and store them in to a CSV file!

from faker import Faker
import csv
fake = Faker('en_US')

header = ['firt_name', 'last_name']


with open('us_female.csv', 'w', encoding='UTF8', newline='') as file:
    writer = csv.writer(file)
    i = 0
    while i <5000:
        data = [fake.first_name_female(), fake.last_name_female()]
        writer.writerow(data)
        i = i + 1
Enter fullscreen mode Exit fullscreen mode

I am sharing this code with you guys, may be i will help any one like my friend!

Top comments (4)

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

Want fake data? Mockaroo. Names, genders, birth dates, counties, ID's, and sooo many more.

Collapse
 
meetsohail profile image
Sohail Ahmed

Wow Jose, You have shared wonderful website to generate fake data! How can we define location?

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

When you are creating a schema, click a field's data type button. The Choose a Type dialog appears. Select Location. There are 14 different types of location data. Here's a screenshot:

Coose a Type -> Location | Mockaroo.com

Thread Thread
 
meetsohail profile image
Sohail Ahmed

Great Jose! Thank you for letting us know!