No project description provided
Project description
Faux-lars
fauxlars
is a speedy fake data generation library.
Example
Install the library
python -m venv .venv && source .venv/bin/activate && python -m pip install faux_lars
Let's generate some data
import polars as pl
from faux_lars import generate_lazyframe
rows =5000
df = (
generate_lazyframe(
{
"clicks": pl.UInt8,
"Name": "name",
"City Name": "city_name",
"Phone": "mobile_number",
},
rows,
"en",
).collect()
)
print(df)
┌────────┬──────────────────┬──────────────────────────┬────────────────┐
│ clicks ┆ Name ┆ City Name ┆ Phone │
│ --- ┆ --- ┆ --- ┆ --- │
│ u8 ┆ str ┆ str ┆ str │
╞════════╪══════════════════╪══════════════════════════╪════════════════╡
│ 207 ┆ Erik Conn ┆ Beier stad ┆ 512-797-9451 │
│ 66 ┆ Hildegard Murphy ┆ Wintheiser bury ┆ (907) 011-3125 │
│ 38 ┆ Tremayne Casper ┆ Okuneva land ┆ 933.955.5987 │
│ 157 ┆ Kamille Haley ┆ McGlynn furt ┆ 329.524.7080 │
│ 123 ┆ Erika Kozey ┆ East Favian Fisher burgh ┆ 1-846-364-8772 │
│ … ┆ … ┆ … ┆ … │
│ 25 ┆ Chadd Rosenbaum ┆ Nader furt ┆ 201-837-7966 │
│ 50 ┆ Tevin Jerde ┆ Davis shire ┆ 1-125-407-6570 │
│ 22 ┆ Antwan Jones ┆ West Sammie Hirthe shire ┆ 365-256-8860 │
│ 120 ┆ Eden McCullough ┆ Goldner shire ┆ 1-950-582-2326 │
│ 76 ┆ Tevin Batz ┆ Bauch mouth ┆ 560-202-3844 │
└────────┴──────────────────┴──────────────────────────┴────────────────┘
Docs
The faux_lars
python API is deliberately small and lightweight.
There are two functions:
generate_lazyframe
generate_dataframe
Each receive the following arguments:
schema
: A dictionary ofcolumn_name
,data_type
key, value pairs.data_type
can be a stringdata_type
in the table below, or a non-complex polars DataType object.rows
: The number of rows to generate.language
: Any of the supported locales; see the table below.
Supported Locales
Data Type | en | fr | jp | ar | pt_br | zh_tw | zh_cn |
---|---|---|---|---|---|---|---|
polars_datatypes | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
name | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
first_name | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
last_name | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
building_number | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
city_name | ✓ | ||||||
country_code | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
country_name | ✓ | ||||||
latitude | ✓ | ||||||
longitude | ✓ | ||||||
postcode | ✓ | ||||||
secondary_address | ✓ | ||||||
secondary_address_type | ✓ | ||||||
state_abbr | ✓ | ||||||
state_name | ✓ | ✓ | |||||
street_name | ✓ | ✓ | |||||
time_zone | ✓ | ||||||
zip_code | ✓ | ||||||
isbn | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
isbn_10 | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
isbn_13 | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
bs | ✓ | ||||||
company_name | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
industry | ✓ | ||||||
profession | ✓ | ||||||
credit_card_number | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
currency_code | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
currency_name | ✓ | ||||||
currency_symbol | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
dir_path | ✓ | ||||||
file_ext | ✓ | ||||||
file_name | ✓ | ||||||
file_path | ✓ | ||||||
mime_type | ✓ | ||||||
semver | ✓ | ||||||
semver_stable | ✓ | ||||||
semver_unstable | ✓ | ||||||
licence_plate | ✓ | ||||||
health_insurance_code | ✓ | ||||||
free_email | ✓ | ✓ | ✓ | ||||
bic | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
isin | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
ip | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
ipv4 | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
ipv6 | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
mac_address | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
password | ✓ | ✓ | ✓ | ||||
safe_email | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
user_agent | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
user_name | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
field | ✓ | ✓ | ✓ | ||||
position | ✓ | ✓ | ✓ | ||||
seniority | ✓ | ✓ | ✓ | ||||
title | ✓ | ✓ | ✓ | ||||
lorem | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
cell_number | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
phone_number | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* | ✓* |
Key:
- ✓
- ✓ : supported for this locale.
- ✓* : supported, but this value does not vary by locale.
All non-complex polars DataType objects are supported. These can be passed by name as a string, or as a polars DataType object (see the example above).
For non-sring types, locale is irrelevant. A complex polars Datatype is a struct
, array
, list
, or enum
.
Locales:
en
: Englishfr
: Frenchjp
: Japanesear
: Saudi Arabian Arabicpt_br
: Brazilian Portugesezh_tw
: Traditional Chinesezh_cn
: Simplified Chinese
Benchmarks
- On a laptop with 16GB of RAM and 8 cores, 5,000 rows with 1 utf8 column and three string columns generates in under 0.25 seconds.
- 1,000,000 rows generates in under 7.
- Take a look at
benchmarks
for comparison with two popular python fake data generation libraries:mimesis
andfaker
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file faux_lars-0.1.0.tar.gz
.
File metadata
- Download URL: faux_lars-0.1.0.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5078ff356070f6eaf3729311c18550ac5d43319600710dd2050c9fa5b58ae82d |
|
MD5 | c508f1c9a704a5ab9c2881e7e4e6eb07 |
|
BLAKE2b-256 | ac17fe36565a42d7419ba0580fa099af7e65dbb51ea48df9ea51d1b7b1d110d6 |
File details
Details for the file faux_lars-0.1.0-cp38-abi3-win_amd64.whl
.
File metadata
- Download URL: faux_lars-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1ae2eaaf7730a9a045a182810541e587e65210e481732a106a72bdf2537a71f |
|
MD5 | c4ff480e1b5faa1953531bd9a58f0c84 |
|
BLAKE2b-256 | 2969de3c2403d33fb2e009b19eb1c21b9c08b59abcc6241e4b3926e314b1c401 |
File details
Details for the file faux_lars-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: faux_lars-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.1 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 345f1687d7b3e4d5713ba1dd338d97287751928781b9c410441b66d672dbe703 |
|
MD5 | 6d8b15fd950d8d6a696338d690706543 |
|
BLAKE2b-256 | 8aac465dfd8296c56432b269495d930a90f1345bd5917d1306f75199bdde3ad9 |
File details
Details for the file faux_lars-0.1.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: faux_lars-0.1.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 134afd3ba15aa6d87eaa823076a2f98e0fef1f59c07e6f2a27324f69eb329694 |
|
MD5 | 9f9d9f540945cbe443ba4a9470b59d2b |
|
BLAKE2b-256 | 6262d4cde7f8f8c79be0d041c904c00b3893b664a40af7369e948c4b27c29ea7 |
File details
Details for the file faux_lars-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: faux_lars-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a400734f7d60d23c13adc699cc109ec9aaecbddc8c88f7104d92054f781e08a |
|
MD5 | 3a57509a11e6fb7f56a705226aba86b1 |
|
BLAKE2b-256 | d14d3941066921907e60954e295fabd910f20b2ae8c235c989236d3b4cd17856 |
File details
Details for the file faux_lars-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: faux_lars-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 4.7 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cc32d449d3eff66013f328dfe370fe26cbae3a277fdc959fb837c5069a68ace |
|
MD5 | a6e97261025b18d7de91f10b3bf22894 |
|
BLAKE2b-256 | dd5eb7ff5a05c682626a8bcecaeb53c273073fea756615ddcf3294d135e26b5e |