gen_dataset

In [ ]:
gen_dataset(features_ranges: dict, 
            cursor=None, 
            nrows: int = 1000,)

Generates a dataset using the input parameters.

Parameters

Name Type Optional Description
features_ranges
dict
Dictionary including the features types and ranges.
  • For str :The subdictionary must include two keys. 'type' must be set to 'str' and 'value' must include the feature categories.
  • For int :The subdictionary must include two keys. 'type' must be set to 'int' and 'range' must include two integers that represent the lower and the upper bound.
  • For float :The subdictionary must include two keys. 'type' must be set to 'float' and 'range' must include two floats that represent the lower and the upper bound.
  • For date :The subdictionary must include two keys. 'type' must be set to 'date' and 'range' must include the start date and the number of days after.
  • For datetime :The subdictionary must include two keys. 'type' must be set to 'date' and 'range' must include the start date and the number of days after.
cursor
DBcursor
Vertica database cursor.
nrows
int
Dataset maximum number of rows.

Returns

vDataFrame : generated dataset.

Example

In [2]:
from verticapy.datasets import gen_dataset
import datetime

gen_dataset(features_ranges = {"name": {"type": str, "values": ["Badr", "Badr", "Raghu", "Waqas",]},
                               "age": {"type": int, "range": [20, 40]},
                               "distance": {"type": float, "range": [1000, 4000]},
                               "date": {"type": datetime.date, "range": ["1993-11-03", 365]},
                               "datetime": {"type": datetime.datetime, "range": ["1993-11-03", 365]},},)
Out[2]:
Abc
name
Varchar(5)
123
age
Int
123
distance
Float
📅
date
Date
📅
datetime
Timestamp
1Badr292269.104789709671994-01-051994-02-01 07:00:45.293364
2Raghu223088.368733879181994-10-291994-10-07 05:31:59.813338
3Badr352723.093271255491994-03-101994-06-12 15:00:40.574694
4Waqas213224.468061467631994-08-161994-09-02 00:31:32.678368
5Badr391924.787132535131994-01-231994-02-11 17:46:15.152694
6Raghu352547.522228909661994-06-131993-11-12 10:38:47.507479
7Badr382472.602771595121994-09-191994-02-14 18:33:57.636906
8Badr301263.78835621291993-12-071994-09-22 06:13:12.043944
9Badr342632.375379325821994-09-291994-03-17 16:35:03.410143
10Badr332647.362243151291993-11-281994-01-19 00:20:21.087985
11Waqas373794.272236293181994-07-301993-12-08 12:45:23.997536
12Waqas371256.013594800611994-07-131994-04-22 00:38:28.402084
13Badr361619.255434488881994-10-091994-03-02 22:33:10.480983
14Waqas371474.760811543091994-03-041993-12-19 14:56:16.774174
15Badr243457.121059531351994-07-071993-12-12 22:13:51.827138
16Raghu243228.341704932971994-03-121994-02-15 15:56:48.898146
17Waqas213019.643259933221994-09-051994-06-04 06:36:10.053870
18Waqas373834.079373162241994-03-231994-07-17 11:14:46.077907
19Badr241423.282897099851994-03-091994-09-01 18:18:30.802987
20Badr201917.837911052631993-12-161994-03-20 16:04:26.451227
21Raghu372727.387668099251994-09-061994-03-27 19:41:24.157283
22Badr211711.539481533691994-06-111993-11-12 08:36:05.553948
23Badr311817.124003777281994-02-181994-05-16 19:40:25.091017
24Badr321148.908403934911994-04-091994-08-09 14:46:55.544911
25Raghu222588.612263556571994-09-091994-02-16 01:28:05.472337
26Badr293595.329432515431994-09-301994-04-25 17:06:32.208306
27Badr223775.734884198761994-06-241994-05-21 13:17:59.121231
28Waqas381199.307614238931994-01-261994-06-14 10:41:49.917191
29Badr213437.130301492291994-02-171994-08-27 17:58:45.256511
30Waqas303351.504831342031994-07-221994-08-27 16:18:48.532147
31Raghu302216.400099219751993-11-201994-04-01 11:50:03.959137
32Waqas361951.209630118681993-12-111993-11-10 03:35:22.084064
33Badr332946.574871893971994-07-281994-03-02 21:40:39.441546
34Badr311509.189312579111994-08-061994-09-20 14:20:30.561514
35Raghu391642.819244181741994-06-241994-01-06 03:23:27.748228
36Waqas243342.716684564951994-09-271994-08-21 14:59:58.522921
37Raghu401363.07533038781993-12-161994-10-18 12:01:23.706205
38Waqas323120.739036239681994-06-021994-07-04 11:50:32.766585
39Badr403295.623981393871994-10-041994-10-21 09:21:16.518765
40Raghu301365.729399956761993-12-071994-10-13 13:53:13.931124
41Raghu271323.193229269241994-05-151994-07-15 10:21:07.636643
42Badr201373.573173768821994-03-141994-01-12 13:08:17.978517
43Badr311744.815609185031994-10-281993-12-07 19:33:17.828398
44Badr382282.700048061091994-09-021994-04-17 23:46:07.324653
45Badr221447.263350244611994-10-151994-09-30 13:46:52.367874
46Waqas403844.2118933891994-10-141994-04-12 21:04:23.946185
47Waqas271218.191075371581994-01-021994-10-03 08:45:29.098166
48Waqas342042.872953228651993-12-021994-01-20 23:59:47.280314
49Badr343579.431795282291994-04-301994-01-18 06:01:16.966893
50Badr222462.386875879021994-01-221994-05-18 04:28:14.240887
51Raghu353927.935655694451994-10-121994-04-16 00:00:06.330905
52Waqas201127.033394062891994-02-271994-10-22 16:32:47.781548
53Badr312526.347186882051994-06-051994-04-30 23:54:44.908589
54Waqas242326.48783805781993-11-271994-04-21 19:21:14.801642
55Raghu393580.11936699041994-07-071994-02-13 07:06:30.185639
56Badr222480.566459707921994-04-151994-07-12 16:54:56.027351
57Waqas373193.104700185361994-07-121994-05-26 01:29:59.479484
58Badr212324.706832412631994-01-051994-06-20 09:29:29.266706
59Badr291430.943943327291994-08-111994-02-24 06:21:42.287907
60Badr331082.859439309691994-03-011994-05-25 20:32:30.121763
61Badr252321.754048578441994-06-251993-11-05 06:10:46.894580
62Raghu382685.597363859421994-04-181994-09-25 01:49:06.562339
63Badr383902.087191352621993-12-061994-10-26 04:26:12.107050
64Badr383507.878203643491993-11-261994-01-27 19:33:41.294656
65Waqas372993.376785190781994-01-121994-08-10 03:37:43.797176
66Badr342710.468754637991994-04-131994-10-23 09:10:31.164853
67Raghu262433.453718200331994-10-191994-09-29 06:27:23.567850
68Waqas372254.637114936491994-08-301994-09-27 00:31:26.112723
69Badr321933.969491394241994-01-051994-03-22 02:06:35.236634
70Badr292229.995730565861994-09-131994-09-16 02:57:45.527102
71Raghu283837.984825950121994-02-101994-05-30 08:28:01.358144
72Badr222865.03237974831994-02-111994-05-09 17:44:15.191425
73Waqas241047.466248972341994-01-131994-05-22 23:26:44.712573
74Badr381523.036174010491994-07-031994-05-04 20:05:02.266509
75Badr311582.663159118971994-10-311994-04-12 20:45:03.456603
76Raghu342797.995765693491994-04-281993-11-08 11:09:04.507058
77Badr373185.965753626081994-09-021994-03-27 14:51:10.344776
78Raghu253959.180667297911994-04-151994-07-29 20:53:27.557208
79Waqas383463.52836582811994-07-291994-08-21 18:48:33.431834
80Raghu402763.649776810781994-01-061994-09-20 23:26:01.015546
81Raghu402963.434218661861993-11-201994-06-12 22:33:11.970474
82Raghu343855.912495171651993-12-091994-07-10 02:36:34.288132
83Waqas381895.840780343861994-01-101994-04-22 15:50:10.451987
84Waqas271096.835366683081994-04-051994-04-07 13:52:22.129232
85Waqas313626.879838760941994-09-091994-07-31 23:47:12.223919
86Badr253401.82730671951994-10-211994-08-18 03:35:07.287101
87Badr263407.37156965771994-05-121994-02-07 21:22:28.895721
88Badr251813.680460210891994-04-271994-01-14 16:10:11.915859
89Badr323530.774974497041994-05-281994-04-14 02:09:17.831347
90Raghu353761.892444919791994-02-061993-11-16 18:13:49.493389
91Waqas271166.773819364611994-09-241994-02-03 17:13:18.116807
92Raghu222028.027041582391994-10-121994-03-30 16:05:39.488449
93Badr372208.399970782921994-05-141994-01-16 16:03:06.008654
94Waqas361462.425536941741994-07-311994-07-28 23:47:10.227209
95Raghu293945.618849946191994-08-141994-02-22 23:47:42.352885
96Raghu262708.346161292871994-04-061993-12-16 14:46:16.411267
97Badr213751.579719362781994-10-121994-04-23 16:16:48.310027
98Waqas262216.998831834641994-04-181994-01-06 08:09:12.838194
99Waqas352412.102714879441994-04-201994-06-02 11:13:27.739869
100Raghu263265.758986584841994-01-301994-04-29 03:06:09.080999
Rows: 1-100 | Columns: 5