To answer the question:

now how do I make sure the generated id is unique in the dataset?

You have to use: unique.random_int

So, your code will be like this as you see below:

from faker import Faker
import random
import pandas as pd

Faker.seed(0)
random.seed(0)
fake = Faker("en_US") 
fixed_digits = 6
concatid = 'ID'
idcode,name, city, country, job, age = [[] for k in range(0,6)] 

for row in range(0,100):
    idcode.append(concatid + str(fake.unique.random_int(min=111111, max=999999)))
    name.append(fake.name())
    city.append(fake.city())
    country.append(fake.country())
    job.append(fake.job())
    age.append(random.randint(20,100))

d = {"ID Code":idcode, "Name":name, "Age":age, "City":city, "Country":country, "Job":job}
df = pd.DataFrame(d)
df.head()
Answer from Geek Logbook on Stack Overflow
🌐
Faker
faker.readthedocs.io › en › master › providers › faker.providers.python.html
faker.providers.python — Faker 40.12.0 documentation
pystr_format(string_format: str = '?#-###{{random_int}}{{random_letter}}', letters: str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') → str¶ ... >>> Faker.seed(0) >>> for _ in range(5): ... fake.pystr_format() ...
🌐
Faker
faker.readthedocs.io › en › master › providers › baseprovider.html
faker.providers. - BaseProvider - Faker's documentation!
If digits is None (default), its value will be set to a random integer from 1 to 9. If fix_len is False (default), all integers that do not exceed the number of digits can be generated. If fix_len is True, only integers with the exact number of digits can be generated.
🌐
CodingNomads
codingnomads.com › how-to-use-python-faker-random-data-generator
How to Use Python Faker: Random Data Generator
In this case, n is a random number between 0 and the number of users, less one. Want to know my favorite Python Faker function? It's gotta be bs() which stands for [BEEEEP] and generates some cool-sounding titles for each composition. "Orchestrate Bricks-and-Clicks Portals" is but one example of ...
🌐
DEV Community
dev.to › dev_neil_a › python-how-to-create-sample-data-using-faker-co4
Python How-To: Create Sample Data Using Faker - DEV Community
October 20, 2024 - Prior to using faker, it will need to be installed as it is a third-party library that is not part of the base Python library collection. To do this, use the pip command in the terminal as follows: ... The following example will generate three addresses and peoples names, each of which will be a dictionary that will be added to a list. # --- 1. Import the required libraries: from faker import Faker from random import randint # --- 2.
🌐
ZetCode
zetcode.com › python › faker
Python Faker - generating fake data in Python with Faker module
January 29, 2024 - The example creates six fake jobs. $ ./jobs.py Town planner Paediatric nurse Geographical information systems officer Water quality scientist Engineer, maintenance Designer, ceramics/pottery · The Faker supports localized data to some extent. The locale is passed to the constructor method. Note that the locales are finished to various levels. ... #!/usr/bin/python from faker import Faker faker = Faker('cz_CZ') for i in range(3): name = faker.name() address = faker.address() phone = faker.phone_number() print(f'{name}, {address}, {phone}')
🌐
HotExamples
python.hotexamples.com › examples › faker › Faker › random_int › python-faker-random_int-method-examples.html
Python Faker.random_int Examples, faker.Faker.random_int Python Examples - HotExamples
rand_pub = randint(1, 10) publish_query = Publisher.objects.get(id=rand_pub) rand_genre = randint(1, 8) genre_query = Genre.objects.get(id=rand_genre) book = Book( name=fake.text(max_nb_chars=40), active=True, unit_price=fake.pydecimal( left_digits=2, right_digits=2, positive=True), ...
🌐
Linux Hint
linuxhint.com › python-faker-generate-dummy-data
How to Use Python Faker to Generate Dummy Data – Linux Hint
Different types of random numbers can be generated by using the faker library. Create a Python file with the following script that will generate three types of random numbers. The random_int() function will generate a random integer number. The random_number(digit=5) function will generate ...
Find elsewhere
🌐
Blue Book
lyz-code.github.io › blue-book › coding › python › faker
Faker - The Blue Book
from random import SystemRandom @pytest.fixture(scope="session", autouse=True) def faker_seed() -> int: """Create a random seed for the Faker library.""" return SystemRandom().randint(0, 999999)
🌐
GitHub
github.com › joke2k › faker
GitHub - joke2k/faker: Faker is a Python package that generates fake data for you. · GitHub
Factory Boy already ships with integration with Faker. Simply use the factory.Faker method of factory_boy: import factory from myapp.models import Book class BookFactory(factory.Factory): class Meta: model = Book title = factory.Faker('sentence', nb_words=4) author_name = factory.Faker('name') The .random property on the generator returns the instance of random.Random used to generate the values:
Starred by 19.2K users
Forked by 2.1K users
Languages   Python
🌐
PyPI
pypi.org › project › Faker
Faker · PyPI
When using Faker for unit testing, you will often want to generate the same data set. For convenience, the generator also provides a seed() method, which seeds the shared random number generator.
      » pip install Faker
    
Published   Mar 30, 2026
Version   40.12.0
🌐
GitHub
gist.github.com › rg3915 › 744aacde209046901748
Generate random values with Python gen_random faker gen_date fake gen date fake · GitHub
Generate random values with Python gen_random faker gen_date fake gen date fake - gen_random_values.py
🌐
Faker
faker.readthedocs.io › en › master › providers › faker.providers.misc.html
faker.providers.misc — Faker 40.11.1 documentation
boolean(chance_of_getting_true: int = 50) → bool¶ · Generate a random boolean value based on chance_of_getting_true. ... >>> Faker.seed(0) >>> for _ in range(5): ... fake.boolean(chance_of_getting_true=25) ...
🌐
Faker
faker.readthedocs.io › en › latest › providers › faker.providers.python.html
faker.providers.python — Faker 40.11.1 documentation
pystr_format(string_format: str = '?#-###{{random_int}}{{random_letter}}', letters: str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') → str¶ ... >>> Faker.seed(0) >>> for _ in range(5): ... fake.pystr_format() ...
🌐
Faker
faker.readthedocs.io › en › stable › providers › faker.providers.python.html
faker.providers.python — Faker 40.4.0 documentation
pystr_format(string_format: str = '?#-###{{random_int}}{{random_letter}}', letters: str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') → str¶ ... >>> Faker.seed(0) >>> for _ in range(5): ... fake.pystr_format() ...
🌐
Towards Data Science
towardsdatascience.com › home › latest › fake (almost) everything with faker
Fake (almost) everything with Faker | Towards Data Science
January 19, 2025 - Generating customer and address data for testing has never been easier. We'll see how to do that using the Faker Python library. ... I was recently tasked with creating some random customer data, with names, phone numbers, addresses, and the usual other stuff.
🌐
Faker
faker.readthedocs.io › en › master › fakerclass.html
Using the Faker Class — Faker 40.12.0 documentation
Use the class method `Faker.seed()` instead. The rationale can be found in the relevant PR, but the goal is to deal with a non-explicit legacy behavior involving a shared random.Random instance that we believe can only become more confusing once new Faker is added.
🌐
Faker
faker.readthedocs.io
Welcome to Faker’s documentation! — Faker 40.12.0 documentation
When using Faker for unit testing, you will often want to generate the same data set. For convenience, the generator also provides a seed() method, which seeds the shared random number generator.