fakedata-python 2.0.1__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fakedata_python-2.0.1/fakedata_python.egg-info → fakedata_python-2.0.2}/PKG-INFO +62 -4
- fakedata_python-2.0.1/PKG-INFO → fakedata_python-2.0.2/README.md +60 -14
- fakedata_python-2.0.2/fakedata/cli.py +133 -0
- fakedata_python-2.0.1/README.md → fakedata_python-2.0.2/fakedata_python.egg-info/PKG-INFO +72 -2
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata_python.egg-info/SOURCES.txt +2 -0
- fakedata_python-2.0.2/fakedata_python.egg-info/entry_points.txt +2 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/pyproject.toml +5 -2
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/__init__.py +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/core.py +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/cardtype.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/companies.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/countries.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/devices.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/domain.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/email.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/first.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/healthcare.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/hobbies.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/industries.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/job_categories.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/job_titles.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/last.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/locales.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/middle.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/occupation.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/salary_ranges.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/shortformstate.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/state.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/states.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/street.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/helpers/universities.json +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/modules/__init__.py +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/modules/data.py +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata/test_python.py +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata_python.egg-info/dependency_links.txt +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata_python.egg-info/top_level.txt +0 -0
- {fakedata_python-2.0.1 → fakedata_python-2.0.2}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fakedata-python
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: The fakedata package generates realistic synthetic user profiles for machine learning, deep learning, data analysis, and data science workflows.
|
|
5
|
-
Author-email: abhay557 <
|
|
5
|
+
Author-email: abhay557 <contact@abhaymourya.in>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/abhay557/fakedata
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -33,8 +33,10 @@ A high-performance, **zero-dependency** synthetic data generation engine, availa
|
|
|
33
33
|
- **Anomaly Injection**: Inject fraud/outlier profiles (e.g., impossible geography, credit fraud, income spikes) using `anomaly_rate`.
|
|
34
34
|
- **Time-Series Data**: Generate chronological activity logs (logins, page views, purchases) per user for behavioral modeling.
|
|
35
35
|
- **Pipeline Ready**: Export directly to CSV, JSON, or Flat objects (perfect for `pandas.DataFrame`).
|
|
36
|
+
- **CLI Tool**: Generate and export datasets directly from your terminal — no scripting required.
|
|
36
37
|
|
|
37
38
|
---
|
|
39
|
+
|
|
38
40
|
## Python Implementation
|
|
39
41
|
|
|
40
42
|
### Installation
|
|
@@ -58,8 +60,6 @@ print(df.head())
|
|
|
58
60
|
ts = data.user_time_series({"days": 30, "events_per_day": 8})
|
|
59
61
|
print(f"Generated {len(ts['activity'])} events for {ts['user']['fullName']}")
|
|
60
62
|
```
|
|
61
|
-
|
|
62
|
-
|
|
63
63
|
## Node.js / TypeScript Implementation
|
|
64
64
|
|
|
65
65
|
### Installation
|
|
@@ -81,8 +81,66 @@ const csvString = data.usersToCSV(1000, { seed: 42 });
|
|
|
81
81
|
const ts = data.userTimeSeries({ days: 30, eventsPerDay: 8 });
|
|
82
82
|
console.log(`Generated ${ts.activity.length} events for ${ts.user.fullName}`);
|
|
83
83
|
```
|
|
84
|
+
|
|
84
85
|
---
|
|
85
86
|
|
|
87
|
+
## CLI — Command Line Interface
|
|
88
|
+
|
|
89
|
+
After installing, use `fakedata` directly from your terminal. No scripts needed!
|
|
90
|
+
|
|
91
|
+
### Node.js (global install)
|
|
92
|
+
```bash
|
|
93
|
+
npm install -g @abhay557/fakedata
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Python (global install)
|
|
97
|
+
```bash
|
|
98
|
+
pip install fakedata-python
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### CLI Commands
|
|
102
|
+
|
|
103
|
+
| Command | Description |
|
|
104
|
+
|:---|:---|
|
|
105
|
+
| `fakedata generate` | Generate synthetic user data |
|
|
106
|
+
| `fakedata preview` | Print a single user profile to the console |
|
|
107
|
+
| `fakedata help` | Show all available options |
|
|
108
|
+
|
|
109
|
+
### CLI Options
|
|
110
|
+
|
|
111
|
+
| Flag | Default | Description |
|
|
112
|
+
|:---|:---|:---|
|
|
113
|
+
| `-n`, `--count` | `10` | Number of users to generate |
|
|
114
|
+
| `-f`, `--format` | `json` | Output format: `json` \| `csv` \| `flat` |
|
|
115
|
+
| `-o`, `--output` | stdout | Output file path |
|
|
116
|
+
| `-s`, `--seed` | none | Random seed for reproducibility |
|
|
117
|
+
| `-l`, `--locale` | `en` | Locale: `en` \| `in` \| `jp` \| `kr` \| `de` \| `br` \| `ar` \| `fr` |
|
|
118
|
+
| `-a`, `--anomaly-rate` | `0` | Fraction of anomalous users (0–1) |
|
|
119
|
+
| `-m`, `--missing-rate` | `0` | Fraction of null fields (0–1) |
|
|
120
|
+
| `-t`, `--timeseries` | — | Include time-series activity logs |
|
|
121
|
+
| `--days` | `30` | Days of activity for time-series |
|
|
122
|
+
| `--pretty` | — | Pretty-print JSON output |
|
|
123
|
+
|
|
124
|
+
### Examples
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Generate 1000 users and save as CSV
|
|
128
|
+
fakedata generate -n 1000 -f csv -o dataset.csv
|
|
129
|
+
|
|
130
|
+
# Generate 500 deterministic Indian users
|
|
131
|
+
fakedata generate -n 500 -l in --seed 42 -o india.json
|
|
132
|
+
|
|
133
|
+
# Fraud detection dataset with 5% anomalies
|
|
134
|
+
fakedata generate -n 10000 -a 0.05 -f csv -o fraud_data.csv
|
|
135
|
+
|
|
136
|
+
# Preview a single user in the console
|
|
137
|
+
fakedata preview
|
|
138
|
+
|
|
139
|
+
# Time-series activity logs for 100 users
|
|
140
|
+
fakedata generate -n 100 --timeseries --days 60 -o activity.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
86
144
|
### sample output - one user
|
|
87
145
|
```fakedata.data.user()```
|
|
88
146
|
```fakedata.data.user(n) // set n = 100```
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: fakedata-python
|
|
3
|
-
Version: 2.0.1
|
|
4
|
-
Summary: The fakedata package generates realistic synthetic user profiles for machine learning, deep learning, data analysis, and data science workflows.
|
|
5
|
-
Author-email: abhay557 <abhaycormourya@gmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/abhay557/fakedata
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.7
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
|
|
13
1
|
# fakedata
|
|
14
2
|
|
|
15
3
|
[](https://www.npmjs.com/package/@abhay557/fakedata)
|
|
@@ -33,8 +21,10 @@ A high-performance, **zero-dependency** synthetic data generation engine, availa
|
|
|
33
21
|
- **Anomaly Injection**: Inject fraud/outlier profiles (e.g., impossible geography, credit fraud, income spikes) using `anomaly_rate`.
|
|
34
22
|
- **Time-Series Data**: Generate chronological activity logs (logins, page views, purchases) per user for behavioral modeling.
|
|
35
23
|
- **Pipeline Ready**: Export directly to CSV, JSON, or Flat objects (perfect for `pandas.DataFrame`).
|
|
24
|
+
- **CLI Tool**: Generate and export datasets directly from your terminal — no scripting required.
|
|
36
25
|
|
|
37
26
|
---
|
|
27
|
+
|
|
38
28
|
## Python Implementation
|
|
39
29
|
|
|
40
30
|
### Installation
|
|
@@ -58,8 +48,6 @@ print(df.head())
|
|
|
58
48
|
ts = data.user_time_series({"days": 30, "events_per_day": 8})
|
|
59
49
|
print(f"Generated {len(ts['activity'])} events for {ts['user']['fullName']}")
|
|
60
50
|
```
|
|
61
|
-
|
|
62
|
-
|
|
63
51
|
## Node.js / TypeScript Implementation
|
|
64
52
|
|
|
65
53
|
### Installation
|
|
@@ -81,8 +69,66 @@ const csvString = data.usersToCSV(1000, { seed: 42 });
|
|
|
81
69
|
const ts = data.userTimeSeries({ days: 30, eventsPerDay: 8 });
|
|
82
70
|
console.log(`Generated ${ts.activity.length} events for ${ts.user.fullName}`);
|
|
83
71
|
```
|
|
72
|
+
|
|
84
73
|
---
|
|
85
74
|
|
|
75
|
+
## CLI — Command Line Interface
|
|
76
|
+
|
|
77
|
+
After installing, use `fakedata` directly from your terminal. No scripts needed!
|
|
78
|
+
|
|
79
|
+
### Node.js (global install)
|
|
80
|
+
```bash
|
|
81
|
+
npm install -g @abhay557/fakedata
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Python (global install)
|
|
85
|
+
```bash
|
|
86
|
+
pip install fakedata-python
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### CLI Commands
|
|
90
|
+
|
|
91
|
+
| Command | Description |
|
|
92
|
+
|:---|:---|
|
|
93
|
+
| `fakedata generate` | Generate synthetic user data |
|
|
94
|
+
| `fakedata preview` | Print a single user profile to the console |
|
|
95
|
+
| `fakedata help` | Show all available options |
|
|
96
|
+
|
|
97
|
+
### CLI Options
|
|
98
|
+
|
|
99
|
+
| Flag | Default | Description |
|
|
100
|
+
|:---|:---|:---|
|
|
101
|
+
| `-n`, `--count` | `10` | Number of users to generate |
|
|
102
|
+
| `-f`, `--format` | `json` | Output format: `json` \| `csv` \| `flat` |
|
|
103
|
+
| `-o`, `--output` | stdout | Output file path |
|
|
104
|
+
| `-s`, `--seed` | none | Random seed for reproducibility |
|
|
105
|
+
| `-l`, `--locale` | `en` | Locale: `en` \| `in` \| `jp` \| `kr` \| `de` \| `br` \| `ar` \| `fr` |
|
|
106
|
+
| `-a`, `--anomaly-rate` | `0` | Fraction of anomalous users (0–1) |
|
|
107
|
+
| `-m`, `--missing-rate` | `0` | Fraction of null fields (0–1) |
|
|
108
|
+
| `-t`, `--timeseries` | — | Include time-series activity logs |
|
|
109
|
+
| `--days` | `30` | Days of activity for time-series |
|
|
110
|
+
| `--pretty` | — | Pretty-print JSON output |
|
|
111
|
+
|
|
112
|
+
### Examples
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Generate 1000 users and save as CSV
|
|
116
|
+
fakedata generate -n 1000 -f csv -o dataset.csv
|
|
117
|
+
|
|
118
|
+
# Generate 500 deterministic Indian users
|
|
119
|
+
fakedata generate -n 500 -l in --seed 42 -o india.json
|
|
120
|
+
|
|
121
|
+
# Fraud detection dataset with 5% anomalies
|
|
122
|
+
fakedata generate -n 10000 -a 0.05 -f csv -o fraud_data.csv
|
|
123
|
+
|
|
124
|
+
# Preview a single user in the console
|
|
125
|
+
fakedata preview
|
|
126
|
+
|
|
127
|
+
# Time-series activity logs for 100 users
|
|
128
|
+
fakedata generate -n 100 --timeseries --days 60 -o activity.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
86
132
|
### sample output - one user
|
|
87
133
|
```fakedata.data.user()```
|
|
88
134
|
```fakedata.data.user(n) // set n = 100```
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
fakedata CLI - ML-Ready Synthetic Data Engine
|
|
4
|
+
"""
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
parser = argparse.ArgumentParser(
|
|
13
|
+
prog='fakedata',
|
|
14
|
+
description='fakedata - ML-Ready Synthetic Data Engine (Python)',
|
|
15
|
+
formatter_class=argparse.RawTextHelpFormatter,
|
|
16
|
+
epilog="""
|
|
17
|
+
EXAMPLES:
|
|
18
|
+
# Generate 1000 users to a CSV file
|
|
19
|
+
fakedata generate -n 1000 -f csv -o dataset.csv
|
|
20
|
+
|
|
21
|
+
# Generate 500 deterministic Indian users
|
|
22
|
+
fakedata generate -n 500 -l in --seed 42 -o india.json
|
|
23
|
+
|
|
24
|
+
# Generate fraud detection dataset with 5%% anomalies
|
|
25
|
+
fakedata generate -n 10000 -a 0.05 -f csv -o fraud_data.csv
|
|
26
|
+
|
|
27
|
+
# Preview a single user profile
|
|
28
|
+
fakedata preview
|
|
29
|
+
|
|
30
|
+
# Generate with time-series activity logs
|
|
31
|
+
fakedata generate -n 100 --timeseries --days 60 -o activity.json
|
|
32
|
+
"""
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
subparsers = parser.add_subparsers(dest='command', help='Command to run')
|
|
36
|
+
|
|
37
|
+
# ─── preview ──────────────────────────────────────────────────────────────
|
|
38
|
+
subparsers.add_parser('preview', help='Print a single user profile to the console')
|
|
39
|
+
|
|
40
|
+
# ─── generate ─────────────────────────────────────────────────────────────
|
|
41
|
+
gen = subparsers.add_parser('generate', help='Generate synthetic user data')
|
|
42
|
+
gen.add_argument('-n', '--count', type=int, default=10,
|
|
43
|
+
help='Number of users to generate (default: 10)')
|
|
44
|
+
gen.add_argument('-f', '--format', choices=['json', 'csv', 'flat'], default='json',
|
|
45
|
+
help='Output format: json | csv | flat (default: json)')
|
|
46
|
+
gen.add_argument('-o', '--output', type=str, default=None,
|
|
47
|
+
help='Output file path (default: stdout)')
|
|
48
|
+
gen.add_argument('-s', '--seed', type=int, default=None,
|
|
49
|
+
help='Random seed for reproducibility')
|
|
50
|
+
gen.add_argument('-l', '--locale', type=str, default=None,
|
|
51
|
+
help='Locale: en|in|jp|kr|de|br|ar|fr (default: en)')
|
|
52
|
+
gen.add_argument('-a', '--anomaly-rate', type=float, default=0.0,
|
|
53
|
+
help='Fraction of anomalous users 0-1 (default: 0)')
|
|
54
|
+
gen.add_argument('-m', '--missing-rate', type=float, default=0.0,
|
|
55
|
+
help='Fraction of null fields 0-1 (default: 0)')
|
|
56
|
+
gen.add_argument('-t', '--timeseries', action='store_true',
|
|
57
|
+
help='Include time-series activity logs')
|
|
58
|
+
gen.add_argument('--days', type=int, default=30,
|
|
59
|
+
help='Days of activity for time-series (default: 30)')
|
|
60
|
+
gen.add_argument('--events-per-day', type=int, default=8,
|
|
61
|
+
help='Average events per day for time-series (default: 8)')
|
|
62
|
+
gen.add_argument('--pretty', action='store_true',
|
|
63
|
+
help='Pretty-print JSON output')
|
|
64
|
+
|
|
65
|
+
args = parser.parse_args()
|
|
66
|
+
|
|
67
|
+
if args.command is None or args.command == 'help':
|
|
68
|
+
parser.print_help()
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
# ─── Import the engine (lazy, only when needed) ───────────────────────────
|
|
72
|
+
try:
|
|
73
|
+
import fakedata.modules.data as data
|
|
74
|
+
except ImportError:
|
|
75
|
+
print("ERROR: Could not import fakedata. Make sure it is installed: pip install fakedata-python", file=sys.stderr)
|
|
76
|
+
sys.exit(1)
|
|
77
|
+
|
|
78
|
+
# ─── Preview ─────────────────────────────────────────────────────────────
|
|
79
|
+
if args.command == 'preview':
|
|
80
|
+
u = data.user()
|
|
81
|
+
print(json.dumps(u, indent=2))
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
# ─── Generate ────────────────────────────────────────────────────────────
|
|
85
|
+
if args.command == 'generate':
|
|
86
|
+
options = {
|
|
87
|
+
'seed': args.seed,
|
|
88
|
+
'locale': args.locale,
|
|
89
|
+
'anomaly_rate': args.anomaly_rate,
|
|
90
|
+
'missing_rate': args.missing_rate,
|
|
91
|
+
}
|
|
92
|
+
# Remove None values so defaults are used inside the engine
|
|
93
|
+
options = {k: v for k, v in options.items() if v is not None and v != 0.0}
|
|
94
|
+
|
|
95
|
+
start = time.time()
|
|
96
|
+
|
|
97
|
+
if args.timeseries:
|
|
98
|
+
results = [
|
|
99
|
+
data.user_time_series({**options, 'days': args.days, 'events_per_day': args.events_per_day})
|
|
100
|
+
for _ in range(args.count)
|
|
101
|
+
]
|
|
102
|
+
output = json.dumps(results, indent=2 if args.pretty else None)
|
|
103
|
+
|
|
104
|
+
elif args.format == 'csv':
|
|
105
|
+
output = data.users_to_csv(args.count, options if options else None)
|
|
106
|
+
|
|
107
|
+
elif args.format == 'flat':
|
|
108
|
+
rows = data.users_flat(args.count, options if options else None)
|
|
109
|
+
output = json.dumps(rows, indent=2 if args.pretty else None)
|
|
110
|
+
|
|
111
|
+
else: # json
|
|
112
|
+
if args.pretty:
|
|
113
|
+
output = data.users_to_json(args.count, options if options else None)
|
|
114
|
+
else:
|
|
115
|
+
output = json.dumps(data.users(args.count, options if options else None))
|
|
116
|
+
|
|
117
|
+
elapsed = round(time.time() - start, 2)
|
|
118
|
+
|
|
119
|
+
if args.output:
|
|
120
|
+
out_path = os.path.abspath(args.output)
|
|
121
|
+
with open(out_path, 'w', encoding='utf-8') as f:
|
|
122
|
+
f.write(output)
|
|
123
|
+
size_kb = round(len(output.encode('utf-8')) / 1024, 1)
|
|
124
|
+
print(
|
|
125
|
+
f"✔ Done! Generated {args.count:,} users in {elapsed}s → {out_path} ({size_kb} KB)",
|
|
126
|
+
file=sys.stderr
|
|
127
|
+
)
|
|
128
|
+
else:
|
|
129
|
+
print(output)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
if __name__ == '__main__':
|
|
133
|
+
main()
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fakedata-python
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary: The fakedata package generates realistic synthetic user profiles for machine learning, deep learning, data analysis, and data science workflows.
|
|
5
|
+
Author-email: abhay557 <contact@abhaymourya.in>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/abhay557/fakedata
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.7
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
1
13
|
# fakedata
|
|
2
14
|
|
|
3
15
|
[](https://www.npmjs.com/package/@abhay557/fakedata)
|
|
@@ -21,8 +33,10 @@ A high-performance, **zero-dependency** synthetic data generation engine, availa
|
|
|
21
33
|
- **Anomaly Injection**: Inject fraud/outlier profiles (e.g., impossible geography, credit fraud, income spikes) using `anomaly_rate`.
|
|
22
34
|
- **Time-Series Data**: Generate chronological activity logs (logins, page views, purchases) per user for behavioral modeling.
|
|
23
35
|
- **Pipeline Ready**: Export directly to CSV, JSON, or Flat objects (perfect for `pandas.DataFrame`).
|
|
36
|
+
- **CLI Tool**: Generate and export datasets directly from your terminal — no scripting required.
|
|
24
37
|
|
|
25
38
|
---
|
|
39
|
+
|
|
26
40
|
## Python Implementation
|
|
27
41
|
|
|
28
42
|
### Installation
|
|
@@ -46,8 +60,6 @@ print(df.head())
|
|
|
46
60
|
ts = data.user_time_series({"days": 30, "events_per_day": 8})
|
|
47
61
|
print(f"Generated {len(ts['activity'])} events for {ts['user']['fullName']}")
|
|
48
62
|
```
|
|
49
|
-
|
|
50
|
-
|
|
51
63
|
## Node.js / TypeScript Implementation
|
|
52
64
|
|
|
53
65
|
### Installation
|
|
@@ -69,8 +81,66 @@ const csvString = data.usersToCSV(1000, { seed: 42 });
|
|
|
69
81
|
const ts = data.userTimeSeries({ days: 30, eventsPerDay: 8 });
|
|
70
82
|
console.log(`Generated ${ts.activity.length} events for ${ts.user.fullName}`);
|
|
71
83
|
```
|
|
84
|
+
|
|
72
85
|
---
|
|
73
86
|
|
|
87
|
+
## CLI — Command Line Interface
|
|
88
|
+
|
|
89
|
+
After installing, use `fakedata` directly from your terminal. No scripts needed!
|
|
90
|
+
|
|
91
|
+
### Node.js (global install)
|
|
92
|
+
```bash
|
|
93
|
+
npm install -g @abhay557/fakedata
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Python (global install)
|
|
97
|
+
```bash
|
|
98
|
+
pip install fakedata-python
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### CLI Commands
|
|
102
|
+
|
|
103
|
+
| Command | Description |
|
|
104
|
+
|:---|:---|
|
|
105
|
+
| `fakedata generate` | Generate synthetic user data |
|
|
106
|
+
| `fakedata preview` | Print a single user profile to the console |
|
|
107
|
+
| `fakedata help` | Show all available options |
|
|
108
|
+
|
|
109
|
+
### CLI Options
|
|
110
|
+
|
|
111
|
+
| Flag | Default | Description |
|
|
112
|
+
|:---|:---|:---|
|
|
113
|
+
| `-n`, `--count` | `10` | Number of users to generate |
|
|
114
|
+
| `-f`, `--format` | `json` | Output format: `json` \| `csv` \| `flat` |
|
|
115
|
+
| `-o`, `--output` | stdout | Output file path |
|
|
116
|
+
| `-s`, `--seed` | none | Random seed for reproducibility |
|
|
117
|
+
| `-l`, `--locale` | `en` | Locale: `en` \| `in` \| `jp` \| `kr` \| `de` \| `br` \| `ar` \| `fr` |
|
|
118
|
+
| `-a`, `--anomaly-rate` | `0` | Fraction of anomalous users (0–1) |
|
|
119
|
+
| `-m`, `--missing-rate` | `0` | Fraction of null fields (0–1) |
|
|
120
|
+
| `-t`, `--timeseries` | — | Include time-series activity logs |
|
|
121
|
+
| `--days` | `30` | Days of activity for time-series |
|
|
122
|
+
| `--pretty` | — | Pretty-print JSON output |
|
|
123
|
+
|
|
124
|
+
### Examples
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Generate 1000 users and save as CSV
|
|
128
|
+
fakedata generate -n 1000 -f csv -o dataset.csv
|
|
129
|
+
|
|
130
|
+
# Generate 500 deterministic Indian users
|
|
131
|
+
fakedata generate -n 500 -l in --seed 42 -o india.json
|
|
132
|
+
|
|
133
|
+
# Fraud detection dataset with 5% anomalies
|
|
134
|
+
fakedata generate -n 10000 -a 0.05 -f csv -o fraud_data.csv
|
|
135
|
+
|
|
136
|
+
# Preview a single user in the console
|
|
137
|
+
fakedata preview
|
|
138
|
+
|
|
139
|
+
# Time-series activity logs for 100 users
|
|
140
|
+
fakedata generate -n 100 --timeseries --days 60 -o activity.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
74
144
|
### sample output - one user
|
|
75
145
|
```fakedata.data.user()```
|
|
76
146
|
```fakedata.data.user(n) // set n = 100```
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
pyproject.toml
|
|
3
3
|
fakedata/__init__.py
|
|
4
|
+
fakedata/cli.py
|
|
4
5
|
fakedata/core.py
|
|
5
6
|
fakedata/test_python.py
|
|
6
7
|
fakedata/helpers/cardtype.json
|
|
@@ -30,4 +31,5 @@ fakedata/modules/data.py
|
|
|
30
31
|
fakedata_python.egg-info/PKG-INFO
|
|
31
32
|
fakedata_python.egg-info/SOURCES.txt
|
|
32
33
|
fakedata_python.egg-info/dependency_links.txt
|
|
34
|
+
fakedata_python.egg-info/entry_points.txt
|
|
33
35
|
fakedata_python.egg-info/top_level.txt
|
|
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fakedata-python"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.2"
|
|
8
8
|
authors = [
|
|
9
|
-
{ name="abhay557", email="
|
|
9
|
+
{ name="abhay557", email="contact@abhaymourya.in" },
|
|
10
10
|
]
|
|
11
11
|
description = "The fakedata package generates realistic synthetic user profiles for machine learning, deep learning, data analysis, and data science workflows."
|
|
12
12
|
readme = "README.md"
|
|
@@ -17,6 +17,9 @@ classifiers = [
|
|
|
17
17
|
"Operating System :: OS Independent",
|
|
18
18
|
]
|
|
19
19
|
|
|
20
|
+
[project.scripts]
|
|
21
|
+
fakedata = "fakedata.cli:main"
|
|
22
|
+
|
|
20
23
|
[project.urls]
|
|
21
24
|
"Homepage" = "https://github.com/abhay557/fakedata"
|
|
22
25
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fakedata_python-2.0.1 → fakedata_python-2.0.2}/fakedata_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|