Skip to content

Instantly share code, notes, and snippets.

@alonsoir
Created August 26, 2024 17:06
Show Gist options
  • Save alonsoir/f81463f8230bc7f911bda4e4bf6708f0 to your computer and use it in GitHub Desktop.
Save alonsoir/f81463f8230bc7f911bda4e4bf6708f0 to your computer and use it in GitHub Desktop.
faker sample
import pandas as pd
from faker import Faker
import random
fake = Faker()
def generate_fake_data(num_entries=10):
data = []
for _ in range(num_entries):
entry = {
"Name": fake.name(),
"Address": fake.address(),
"Email": fake.email(),
"Phone Number": fake.phone_number(),
"Date of Birth": fake.date_of_birth(minimum_age=18, maximum_age=65).strftime("%Y-%m-%d"),
"Random Number": random.randint(1, 100),
"Job Title": fake.job(),
"Company": fake.company(),
"Lorem Ipsum Text": fake.text(),
}
data.append(entry)
return pd.DataFrame(data)
if __name__ == "__main__":
num_entries = 10 # You can adjust the number of entries you want to generate
fake_data_df = generate_fake_data(num_entries)
## Dataframe with Fake Data
print(fake_data_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment