Skip to content

Commit f0380c4

Browse files
mail4umaroualib
andauthored
Sphinx RST File Modification - Added QueryProfiler (#900)
* Added QueryProfiler in RST * added okwarning for regexp warnings * fixed geo import * fixed regexp in docstring * fixed geo function backslash * fixed text backslash * fixed backslash for preprocessing * resolving import * comments * add warning for vdataframe text * fixing preprocessing * Update functions.py * small corrections * Update _scaler.py --------- Co-authored-by: Badr <badr.ouali@outlook.fr>
1 parent a56f90e commit f0380c4

File tree

12 files changed

+91
-51
lines changed

12 files changed

+91
-51
lines changed

docs/source/utilities.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,38 @@ Utilities
66

77
______
88

9+
Performance
10+
-------------
11+
12+
Query Performance
13+
^^^^^^^^^^^^^^^^^^
14+
15+
.. currentmodule:: verticapy.performance.vertica.qprof
16+
17+
.. autosummary::
18+
:toctree: api/
19+
20+
QueryProfiler
21+
22+
.. currentmodule:: verticapy.performance.vertica.qprof
23+
24+
**Methods:**
25+
26+
.. autosummary::
27+
:toctree: api/
28+
29+
QueryProfiler.get_cluster_config
30+
QueryProfiler.get_cpu_time
31+
QueryProfiler.get_qduration
32+
QueryProfiler.get_qexecution
33+
QueryProfiler.get_qexecution_report
34+
QueryProfiler.get_qplan
35+
QueryProfiler.get_qplan_profile
36+
QueryProfiler.get_qsteps
37+
QueryProfiler.get_request
38+
QueryProfiler.get_rp_status
39+
QueryProfiler.get_version
40+
QueryProfiler.step
941

1042

1143
Options & Displaying

verticapy/core/vdataframe/_plotting_animated.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def animated_bar(
9292
If set to True, the animation is repeated.
9393
chart: PlottingObject, optional
9494
The chart object used to plot.
95-
\*\*style_kwargs
95+
**style_kwargs
9696
Any optional parameter to pass to the plotting functions.
9797
9898
Returns
@@ -243,7 +243,7 @@ def animated_pie(
243243
If set to True, the animation is repeated.
244244
chart: PlottingObject, optional
245245
The chart object used to plot.
246-
\*\*style_kwargs
246+
**style_kwargs
247247
Any optional parameter to pass to the plotting functions.
248248
249249
Returns
@@ -392,7 +392,7 @@ def animated_plot(
392392
If set to True, the animation is repeated.
393393
chart: PlottingObject, optional
394394
The chart object used to plot.
395-
\*\*style_kwargs
395+
**style_kwargs
396396
Any optional parameter to pass to the plotting
397397
functions.
398398
@@ -554,7 +554,7 @@ def animated_scatter(
554554
If set to True, the animation is repeated.
555555
chart: PlottingObject, optional
556556
The chart object used to plot.
557-
\*\*style_kwargs
557+
**style_kwargs
558558
Any optional parameter to pass to the plotting
559559
functions.
560560

verticapy/core/vdataframe/_scaler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ def scale(
5555
5656
.. math::
5757
58-
Z\_score(x) = (x - x_{avg}) / x_{std}
58+
Z_{score}(x) = (x - x_{avg}) / x_{std}
5959
6060
- robust_zscore:
6161
Normalization using the Robust Z-Score.
6262
6363
.. math::
6464
65-
Z\_rscore(x) = (x - x_{med}) / (1.4826 * x_{mad})
65+
Z_{rscore}(x) = (x - x_{med}) / (1.4826 * x_{mad})
6666
6767
- minmax:
6868
Normalization using the MinMax.
6969
7070
.. math::
7171
72-
Z\_minmax(x) = (x - x_{min}) / (x_{max} - x_{min})
72+
Z_{minmax}(x) = (x - x_{min}) / (x_{max} - x_{min})
7373
7474
Returns
7575
-------
@@ -215,21 +215,21 @@ def scale(
215215
216216
.. math::
217217
218-
Z\_score(x) = (x - x_{avg}) / x_{std}
218+
Z_{score}(x) = (x - x_{avg}) / x_{std}
219219
220220
- robust_zscore:
221221
Normalization using the Robust Z-Score.
222222
223223
.. math::
224224
225-
Z\_rscore(x) = (x - x_{med}) / (1.4826 * x_{mad})
225+
Z_{rscore}(x) = (x - x_{med}) / (1.4826 * x_{mad})
226226
227227
- minmax:
228228
Normalization using the MinMax.
229229
230230
.. math::
231231
232-
Z\_minmax(x) = (x - x_{min}) / (x_{max} - x_{min})
232+
Z_{minmax}(x) = (x - x_{min}) / (x_{max} - x_{min})
233233
by: SQLColumns, optional
234234
vDataColumns used in the partition.
235235
return_trans: bool, optimal

verticapy/core/vdataframe/_text.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,13 @@ def str_extract(self, pat: str) -> "vDataFrame":
432432
433433
.. code-block:: python
434434
435-
data["name"].str_extract(pat = "([A-Za-z])+\.")
435+
data["name"].str_extract(pat = "([A-Za-z])+\\.")
436436
437437
.. ipython:: python
438438
:suppress:
439+
:okwarning:
439440
440-
res = data["name"].str_extract(pat = "([A-Za-z])+\.")
441+
res = data["name"].str_extract(pat = "([A-Za-z])+\\.")
441442
html_file = open("SPHINX_DIRECTORY/figures/core_vDataFrame_text_str_extract.html", "w")
442443
html_file.write(res._repr_html_())
443444
html_file.close()
@@ -504,15 +505,16 @@ def str_replace(self, to_replace: str, value: Optional[str] = None) -> "vDataFra
504505
.. code-block:: python
505506
506507
data["name"].str_replace(
507-
to_replace = "([A-Za-z])+\.",
508+
to_replace = "([A-Za-z])+\\.",
508509
value = "[Name_Prefix]"
509510
)
510511
511512
.. ipython:: python
512513
:suppress:
514+
:okwarning:
513515
514516
res = data["name"].str_replace(
515-
to_replace = "([A-Za-z])+\.",
517+
to_replace = "([A-Za-z])+\\.",
516518
value = "[Name_Prefix]"
517519
)
518520
html_file = open("SPHINX_DIRECTORY/figures/core_vDataFrame_text_str_replace.html", "w")

verticapy/core/vdataframe/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def format_colnames(
6969
7070
Parameters
7171
----------
72-
\*args: str / list / dict, optional
72+
*args: str / list / dict, optional
7373
List of columns' names to format. This allows you
7474
to use multiple objects as input and to format all
7575
of them.

verticapy/machine_learning/memmodel/ensemble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def plot_tree(
7575
tree_id: int, optional
7676
Unique tree identifier, an integer in the
7777
range [0, n_estimators - 1].
78-
\*args, \*\*kwargs: Any, optional
78+
*args, **kwargs: Any, optional
7979
Arguments to pass to the 'to_graphviz' method.
8080
8181
Returns

verticapy/machine_learning/memmodel/preprocessing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ class MinMaxScaler(Scaler):
214214
Parameters
215215
----------
216216
217-
min\_: ArrayLike
217+
min_: ArrayLike
218218
Model's features minimums.
219-
max\_: ArrayLike
219+
max_: ArrayLike
220220
Model's features maximums.
221221
222222
.. note::

verticapy/machine_learning/memmodel/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def plot_tree(
429429
----------
430430
pic_path: str, optional
431431
Absolute path to save the image of the tree.
432-
\*args, \*\*kwargs: Any, optional
432+
*args, **kwargs: Any, optional
433433
Arguments to pass to the 'to_graphviz' method.
434434
435435
Returns

verticapy/machine_learning/vertica/preprocessing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,21 +811,21 @@ class Scaler(Preprocessing):
811811
----------
812812
Many attributes are created during the fitting phase.
813813
814-
**For ``StandardScaler``:**
814+
**For StandardScaler:**
815815
816816
mean_: numpy.array
817817
Model's features means.
818818
std_: numpy.array
819819
Model's features standard deviation.
820820
821-
**For ``MinMaxScaler``:**
821+
**For MinMaxScaler:**
822822
823823
min_: numpy.array
824824
Model's features minimums.
825825
max_: numpy.array
826826
Model's features maximums.
827827
828-
**For ``RobustScaler``:**
828+
**For RobustScaler:**
829829
830830
median_: numpy.array
831831
Model's features medians.

verticapy/sql/functions/regexp.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,17 @@ def regexp_count(
5555
5656
titanic = load_titanic()
5757
# Apply the regexp_count function, creating a new "has_title" column
58-
titanic["has_title"] = vpf.regexp_count(titanic["name"], '([A-Za-z])+\. ')
58+
titanic["has_title"] = vpf.regexp_count(titanic["name"], '([A-Za-z])+\\.')
5959
display(titanic[["name", "has_title"]])
6060
6161
.. ipython:: python
6262
:suppress:
63+
:okwarning:
6364
6465
from verticapy.datasets import load_titanic
6566
import verticapy.sql.functions as vpf
6667
titanic = load_titanic()
67-
titanic["has_title"] = vpf.regexp_count(titanic["name"], '([A-Za-z])+\. ')
68+
titanic["has_title"] = vpf.regexp_count(titanic["name"], '([A-Za-z])+\\.')
6869
html_file = open("SPHINX_DIRECTORY/figures/sql_functions_regexp_regexp_count.html", "w")
6970
html_file.write(titanic[["name", "has_title"]]._repr_html_())
7071
html_file.close()
@@ -104,16 +105,17 @@ def regexp_ilike(expr: SQLExpression, pattern: SQLExpression) -> StringSQL:
104105
105106
titanic = load_titanic()
106107
# Apply the regexp_ilike function, creating a new "has_title" column
107-
titanic["has_title"] = vpf.regexp_ilike(titanic["name"], '([A-Za-z])+\. ')
108+
titanic["has_title"] = vpf.regexp_ilike(titanic["name"], '([A-Za-z])+\\.')
108109
display(titanic[["name", "has_title"]])
109110
110111
.. ipython:: python
111112
:suppress:
113+
:okwarning:
112114
113115
from verticapy.datasets import load_titanic
114116
import verticapy.sql.functions as vpf
115117
titanic = load_titanic()
116-
titanic["has_title"] = vpf.regexp_ilike(titanic["name"], '([A-Za-z])+\. ')
118+
titanic["has_title"] = vpf.regexp_ilike(titanic["name"], '([A-Za-z])+\\.')
117119
html_file = open("SPHINX_DIRECTORY/figures/sql_functions_regexp_regexp_ilike.html", "w")
118120
html_file.write(titanic[["name", "has_title"]]._repr_html_())
119121
html_file.close()
@@ -170,17 +172,18 @@ def regexp_instr(
170172
titanic = load_titanic()
171173
# Apply the regexp_instr function, creating a new "title_start" column
172174
titanic["title_start"] = vpf.regexp_instr(titanic["name"],
173-
'([A-Za-z])+\. ',
175+
'([A-Za-z])+\\.',
174176
return_position = 0)
175177
display(titanic[["name", "title_start"]])
176178
177179
.. ipython:: python
178180
:suppress:
181+
:okwarning:
179182
180183
from verticapy.datasets import load_titanic
181184
import verticapy.sql.functions as vpf
182185
titanic = load_titanic()
183-
titanic["title_start"] = vpf.regexp_instr(titanic["name"], '([A-Za-z])+\. ', return_position = 0)
186+
titanic["title_start"] = vpf.regexp_instr(titanic["name"], '([A-Za-z])+\\.', return_position = 0)
184187
html_file = open("SPHINX_DIRECTORY/figures/sql_functions_regexp_regexp_instr.html", "w")
185188
html_file.write(titanic[["name", "title_start"]]._repr_html_())
186189
html_file.close()
@@ -222,16 +225,17 @@ def regexp_like(expr: SQLExpression, pattern: SQLExpression) -> StringSQL:
222225
223226
titanic = load_titanic()
224227
# Apply the regexp_like function, creating a new "has_title" column
225-
titanic["has_title"] = vpf.regexp_like(titanic["name"], '([A-Za-z])+\. ')
228+
titanic["has_title"] = vpf.regexp_like(titanic["name"], '([A-Za-z])+\\.')
226229
display(titanic[["name", "has_title"]])
227230
228231
.. ipython:: python
229232
:suppress:
233+
:okwarning:
230234
231235
from verticapy.datasets import load_titanic
232236
import verticapy.sql.functions as vpf
233237
titanic = load_titanic()
234-
titanic["has_title"] = vpf.regexp_like(titanic["name"], '([A-Za-z])+\. ')
238+
titanic["has_title"] = vpf.regexp_like(titanic["name"], '([A-Za-z])+\\.')
235239
html_file = open("SPHINX_DIRECTORY/figures/sql_functions_regexp_regexp_like.html", "w")
236240
html_file.write(titanic[["name", "has_title"]]._repr_html_())
237241
html_file.close()
@@ -287,17 +291,18 @@ def regexp_replace(
287291
titanic = load_titanic()
288292
# Apply the regexp_replace function, creating a new "new_title" column
289293
titanic["new_title"] = vpf.regexp_replace(titanic["name"],
290-
'([A-Za-z])+\. ',
294+
'([A-Za-z])+\\.',
291295
'[title here] ')
292296
display(titanic[["name", "new_title"]])
293297
294298
.. ipython:: python
295299
:suppress:
300+
:okwarning:
296301
297302
from verticapy.datasets import load_titanic
298303
import verticapy.sql.functions as vpf
299304
titanic = load_titanic()
300-
titanic["new_title"] = vpf.regexp_replace(titanic["name"], '([A-Za-z])+\. ', '[title here] ')
305+
titanic["new_title"] = vpf.regexp_replace(titanic["name"], '([A-Za-z])+\\.', '[title here] ')
301306
html_file = open("SPHINX_DIRECTORY/figures/sql_functions_regexp_regexp_replace.html", "w")
302307
html_file.write(titanic[["name", "new_title"]]._repr_html_())
303308
html_file.close()
@@ -350,16 +355,17 @@ def regexp_substr(
350355
titanic = load_titanic()
351356
# Apply the regexp_substr function, creating a new "title" column
352357
titanic["title"] = vpf.regexp_substr(titanic["name"],
353-
'([A-Za-z])+\. ')
358+
'([A-Za-z])+\\.')
354359
display(titanic[["name", "title"]])
355360
356361
.. ipython:: python
357362
:suppress:
363+
:okwarning:
358364
359365
from verticapy.datasets import load_titanic
360366
import verticapy.sql.functions as vpf
361367
titanic = load_titanic()
362-
titanic["title"] = vpf.regexp_substr(titanic["name"], '([A-Za-z])+\. ')
368+
titanic["title"] = vpf.regexp_substr(titanic["name"], '([A-Za-z])+\\.')
363369
html_file = open("SPHINX_DIRECTORY/figures/sql_functions_regexp_regexp_substr.html", "w")
364370
html_file.write(titanic[["name", "title"]]._repr_html_())
365371
html_file.close()

0 commit comments

Comments
 (0)