Skip to content

Commit 18652c4

Browse files
committed
PythonScript: More informative default
1 parent 65c6ae5 commit 18652c4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Orange/widgets/data/owpythonscript.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@
3737

3838

3939
DEFAULT_SCRIPT = """import numpy as np
40-
from Orange.data import Table, Domain, ContinuousVariable
41-
42-
arr = np.random.rand(3,3)
43-
domain = Domain([ContinuousVariable(i) for i in ['one', 'two', 'three']])
40+
from Orange.data import Table, Domain, ContinuousVariable, DiscreteVariable
41+
42+
domain = Domain([ContinuousVariable("age"),
43+
ContinuousVariable("height"),
44+
DiscreteVariable("gender", values=("M", "F"))])
45+
arr = np.array([
46+
[25, 186, 0],
47+
[30, 164, 1]])
4448
out_data = Table.from_numpy(domain, arr)
4549
"""
4650

@@ -431,7 +435,7 @@ class Outputs:
431435

432436
settings_version = 2
433437
scriptLibrary: 'List[_ScriptData]' = Setting([{
434-
"name": "from_numpy",
438+
"name": "Table from numpy",
435439
"script": DEFAULT_SCRIPT,
436440
"filename": None
437441
}])

0 commit comments

Comments
 (0)