gen_meshgrid

In [ ]:
gen_meshgrid(features_ranges: dict, 
             cursor=None,)

Generates a dataset using regular steps.

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.
Numerical and date-like features must have an extra key in the dictionary named 'nbins' corresponding to the number of bins used to compute the different categories.
cursor
DBcursor
Vertica database cursor.
nrows
int
Dataset maximum number of rows.

Returns

vDataFrame : generated dataset.

Example

In [5]:
from verticapy.datasets import gen_meshgrid
import datetime

gen_meshgrid(features_ranges = {"name": {"type": str, "values": ["Badr", "Badr", "Raghu", "Waqas",]},
                                "age": {"type": int, "range": [20, 40], "nbins": 3,},
                                "distance": {"type": float, "range": [1000, 4000], "nbins": 3,},
                                "date": {"type": datetime.date, "range": ["1993-11-03", 365], "nbins": 2,},
                                "datetime": {"type": datetime.datetime, "range": ["1993-11-03", 365], "nbins": 2,},},)
Out[5]:
Abc
name
Varchar(5)
123
age
Int
123
distance
Float
📅
date
Date
📅
datetime
Timestamp
1Badr201000.01993-11-031993-11-03 00:00:00
2Badr201000.01993-11-031994-05-04 12:00:00
3Badr201000.01993-11-031994-11-03 00:00:00
4Badr201000.01994-05-041993-11-03 00:00:00
5Badr201000.01994-05-041994-05-04 12:00:00
6Badr201000.01994-05-041994-11-03 00:00:00
7Badr201000.01994-11-031993-11-03 00:00:00
8Badr201000.01994-11-031994-05-04 12:00:00
9Badr201000.01994-11-031994-11-03 00:00:00
10Badr202000.01993-11-031993-11-03 00:00:00
11Badr202000.01993-11-031994-05-04 12:00:00
12Badr202000.01993-11-031994-11-03 00:00:00
13Badr202000.01994-05-041993-11-03 00:00:00
14Badr202000.01994-05-041994-05-04 12:00:00
15Badr202000.01994-05-041994-11-03 00:00:00
16Badr202000.01994-11-031993-11-03 00:00:00
17Badr202000.01994-11-031994-05-04 12:00:00
18Badr202000.01994-11-031994-11-03 00:00:00
19Badr203000.01993-11-031993-11-03 00:00:00
20Badr203000.01993-11-031994-05-04 12:00:00
21Badr203000.01993-11-031994-11-03 00:00:00
22Badr203000.01994-05-041993-11-03 00:00:00
23Badr203000.01994-05-041994-05-04 12:00:00
24Badr203000.01994-05-041994-11-03 00:00:00
25Badr203000.01994-11-031993-11-03 00:00:00
26Badr203000.01994-11-031994-05-04 12:00:00
27Badr203000.01994-11-031994-11-03 00:00:00
28Badr204000.01993-11-031993-11-03 00:00:00
29Badr204000.01993-11-031994-05-04 12:00:00
30Badr204000.01993-11-031994-11-03 00:00:00
31Badr204000.01994-05-041993-11-03 00:00:00
32Badr204000.01994-05-041994-05-04 12:00:00
33Badr204000.01994-05-041994-11-03 00:00:00
34Badr204000.01994-11-031993-11-03 00:00:00
35Badr204000.01994-11-031994-05-04 12:00:00
36Badr204000.01994-11-031994-11-03 00:00:00
37Badr271000.01993-11-031993-11-03 00:00:00
38Badr271000.01993-11-031994-05-04 12:00:00
39Badr271000.01993-11-031994-11-03 00:00:00
40Badr271000.01994-05-041993-11-03 00:00:00
41Badr271000.01994-05-041994-05-04 12:00:00
42Badr271000.01994-05-041994-11-03 00:00:00
43Badr271000.01994-11-031993-11-03 00:00:00
44Badr271000.01994-11-031994-05-04 12:00:00
45Badr271000.01994-11-031994-11-03 00:00:00
46Badr272000.01993-11-031993-11-03 00:00:00
47Badr272000.01993-11-031994-05-04 12:00:00
48Badr272000.01993-11-031994-11-03 00:00:00
49Badr272000.01994-05-041993-11-03 00:00:00
50Badr272000.01994-05-041994-05-04 12:00:00
51Badr272000.01994-05-041994-11-03 00:00:00
52Badr272000.01994-11-031993-11-03 00:00:00
53Badr272000.01994-11-031994-05-04 12:00:00
54Badr272000.01994-11-031994-11-03 00:00:00
55Badr273000.01993-11-031993-11-03 00:00:00
56Badr273000.01993-11-031994-05-04 12:00:00
57Badr273000.01993-11-031994-11-03 00:00:00
58Badr273000.01994-05-041993-11-03 00:00:00
59Badr273000.01994-05-041994-05-04 12:00:00
60Badr273000.01994-05-041994-11-03 00:00:00
61Badr273000.01994-11-031993-11-03 00:00:00
62Badr273000.01994-11-031994-05-04 12:00:00
63Badr273000.01994-11-031994-11-03 00:00:00
64Badr274000.01993-11-031993-11-03 00:00:00
65Badr274000.01993-11-031994-05-04 12:00:00
66Badr274000.01993-11-031994-11-03 00:00:00
67Badr274000.01994-05-041993-11-03 00:00:00
68Badr274000.01994-05-041994-05-04 12:00:00
69Badr274000.01994-05-041994-11-03 00:00:00
70Badr274000.01994-11-031993-11-03 00:00:00
71Badr274000.01994-11-031994-05-04 12:00:00
72Badr274000.01994-11-031994-11-03 00:00:00
73Badr331000.01993-11-031993-11-03 00:00:00
74Badr331000.01993-11-031994-05-04 12:00:00
75Badr331000.01993-11-031994-11-03 00:00:00
76Badr331000.01994-05-041993-11-03 00:00:00
77Badr331000.01994-05-041994-05-04 12:00:00
78Badr331000.01994-05-041994-11-03 00:00:00
79Badr331000.01994-11-031993-11-03 00:00:00
80Badr331000.01994-11-031994-05-04 12:00:00
81Badr331000.01994-11-031994-11-03 00:00:00
82Badr332000.01993-11-031993-11-03 00:00:00
83Badr332000.01993-11-031994-05-04 12:00:00
84Badr332000.01993-11-031994-11-03 00:00:00
85Badr332000.01994-05-041993-11-03 00:00:00
86Badr332000.01994-05-041994-05-04 12:00:00
87Badr332000.01994-05-041994-11-03 00:00:00
88Badr332000.01994-11-031993-11-03 00:00:00
89Badr332000.01994-11-031994-05-04 12:00:00
90Badr332000.01994-11-031994-11-03 00:00:00
91Badr333000.01993-11-031993-11-03 00:00:00
92Badr333000.01993-11-031994-05-04 12:00:00
93Badr333000.01993-11-031994-11-03 00:00:00
94Badr333000.01994-05-041993-11-03 00:00:00
95Badr333000.01994-05-041994-05-04 12:00:00
96Badr333000.01994-05-041994-11-03 00:00:00
97Badr333000.01994-11-031993-11-03 00:00:00
98Badr333000.01994-11-031994-05-04 12:00:00
99Badr333000.01994-11-031994-11-03 00:00:00
100Badr334000.01993-11-031993-11-03 00:00:00
Rows: 1-100 | Columns: 5