"Now, let's generate some data using Mimesis! We will use the **Person** provider class from Mimesis to generate a simple table containing a set of Names, Ages, Genders, Academic Degrees, and Occupations and convert the data into a Pandas DataFrame."
"This is just a small preview of what Mimesis can do in terms of data generation. If you want a more detailed guide, you can follow the very detailed instructions at: \n",
"0 https://wright.com/ robinsondanny Michael Montgomery M \n",
"1 http://welch-miller.com/ robinsondanny Michael Montgomery M \n",
"\n",
" address mail birthdate \n",
"0 Unit 4892 Box 6717\\nDPO AE 71770 bramirez@gmail.com 1943-01-04 \n",
"1 Unit 4892 Box 6717\\nDPO AE 71770 bramirez@gmail.com 1943-01-04 "
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"while True:\n",
" try: \n",
" df = pd.DataFrame(fake.profile())\n",
" except ValueError:\n",
" continue\n",
" break\n",
"df.head()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:6600a76c tags:
# Installing required packages
%% Cell type:code id:ae65adaf tags:
``` python
!pipinstall-r../requirements.txt
```
%% Cell type:markdown id:d9395405 tags:
# Quickstart Guide to Mimesis
%% Cell type:markdown id:85dd7d12 tags:
## Generating Some Data
Now, let's generate some data using Mimesis! We will use the **Person** provider class from Mimesis to generate a simple table containing a set of Names, Ages, Genders, Academic Degrees, and Occupations and convert the data into a Pandas DataFrame.
%% Cell type:code id:4c184360 tags:
``` python
frommimesisimportPerson
frommimesis.localesimportLocale
frommimesis.enumsimportGender
importpandasaspd
```
%% Cell type:code id:3d762ee0 tags:
``` python
person=Person(Locale.EN)
data_list=[{
"Name":person.full_name(),
"Age":person.age(),
"Gender":person.gender(),
"Academic Degree":person.academic_degree(),
"Occupation":person.occupation(),
}for_inrange(100)]
df=pd.DataFrame(data_list)
```
%% Cell type:markdown id:ab22c620 tags:
We will then view the first five rows of our generated data.
%% Cell type:code id:e5d118b2 tags:
``` python
df.head()
```
%% Output
Name Age Gender Academic Degree Occupation
0 Jessenia Roy 31 Female PhD Maintenance Fitter
1 Jasper Schultz 21 Other Bachelor Racehorse Groom
2 Micki Newton 41 Other Bachelor Foundry Worker
3 Doreatha Adams 39 Fluid Master Kitchen Worker
4 Milton Ford 41 Male Bachelor Bank Messenger
%% Cell type:markdown id:d46fda7f tags:
This is just a small preview of what Mimesis can do in terms of data generation. If you want a more detailed guide, you can follow the very detailed instructions at: