Skip to content

Instantly share code, notes, and snippets.

@lordlinus
Created June 18, 2021 04:16
Show Gist options
  • Save lordlinus/c87ebf5d38e70126d6280479236d631a to your computer and use it in GitHub Desktop.
Save lordlinus/c87ebf5d38e70126d6280479236d631a to your computer and use it in GitHub Desktop.
Generate fake data
import cProfile
import io
import pstats
import random
import pandas as pd
from mimesis import Address, Datetime, Person
from mimesis.enums import Gender
person = Person('en')
addess = Address()
datetime = Datetime()
def create_rows_mimesis(num=1):
output = [{
"pii_name": person.full_name(),
"pii_email": person.email(),
"pii_mobile": person.telephone(),
"attribute1": person.age(),
"attribute2": person.blood_type(),
"attribute3": addess.city(),
"attribute4": addess.state(),
"attribute5": datetime.datetime().isoformat(),
"attribute6": person.nationality(),
"attribute7": addess.postal_code(),
} for x in range(num)]
return output
data_frame = pd.DataFrame(data=create_rows_mimesis(5_000))
data_frame.index.name = 'personId'
print(data_frame.head(10))
# data_frame.to_csv("/tmp/test_data.csv", index=False)
data_frame.to_excel(f"/tmp/test_data_{datetime.datetime().now().strftime('%T')}.xlsx",sheet_name='Sheet1',header=True,index=False)%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment