Geek Logbook

Tech sea log book

FAKER: Create Unique Random

You have to use:

unique.random_int(min=11, max=123)

A full example where you can see the creation of a persona is the following:

from faker import Faker
import pandas as pd

fake = Faker()

def create_persona(size=3):
    output = pd.DataFrame()

    for _ in range(size):
        data = {
            'id': fake.unique.random_int(),
            'name': fake.name(),
            'email': fake.free_email(),
            'country': fake.country(),
            'city': fake.city(),
            'address': fake.street_address(),
            }

        generated = pd.DataFrame(data, index=[0])

        output = pd.concat([output, generated])
    return output
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *.