Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

data base creation

from faker import Faker
import pandas as pd
FAKE = Faker()
Faker.seed(42)
FIELDS = ["job", "company", "name", "sex", "mail", "birthdate"]
def create_dummy_data():
    return {k: v for k, v in FAKE.profile().items() if k in FIELDS}
def create_dummy_file(file_path, n_records=10000):
    data = [create_dummy_data() for _ in range(n_records)]
    df = pd.DataFrame(columns=FIELDS).from_dict(data)
    df.to_csv(file_path, sep="|", index_label="id")
if __name__ == "__main__":
    create_dummy_file("dummy_data.csv", n_records=150366)
Comment

PREVIOUS NEXT
Code Example
Python :: python code to scan paper table to excel 
Python :: pandas aggregate rename column 
Python :: qlcdnumber set value 
Python :: #check if the given date is a weekday or weekend 
Python :: downsample audio 
Python :: mock connection sqlalchemy 
Python :: lpython list unino 
Python :: how to avoind DeprecationWarning in python 
Python :: Concatenation of two range() functions 
Python :: list python !g 
Python :: list of class instances in python 
Python :: lda from scratch implementation on iris python 
Python :: python regex exclude letters 
Python :: write an empty block python 
Python :: python relative seek 
Python :: Permission error 
Python :: Trying to set up flask with nginx and gunicorn 
Python :: singke line expresions python 
Python :: Retry function for sending data 
Python :: postgres fecth python 
Python :: ring convert between Numbers and Bytes 
Python :: z3 symbolic expressions cannot be cast to concrete boolean values 
Python :: how to dynamically append value in a list in python 
Python :: how to create dataframe from rdd 
Python :: instaed of: newlist = [] for word in wordlist: newlist.append(word.upper()) 
Python :: Matplotlib-Object oriented interface 
Python :: modwt python github code 
Python :: how to load images from folder in python 
Python :: creating environment variable in python 
Python :: get list of all document in django-elasticsearch-dsl 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =