We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b143a40 commit a7ad94eCopy full SHA for a7ad94e
datascience/util.py
@@ -136,5 +136,9 @@ def wrapper(args):
136
return f(*args)
137
138
result = optimize.minimize(wrapper, start, **vargs)
139
- return np.round(result.x, 7)
+ rounded = np.round(result.x, 7)
140
+ if len(start) == 1:
141
+ return rounded.item(0)
142
+ else:
143
+ return rounded
144
tests/test_util.py
@@ -42,5 +42,5 @@ def test_table_apply():
42
assert all(newtab['b'] == tab['b'] + 1)
43
44
def test_minimize():
45
- assert 2 == ds.minimize(lambda x: (x-2)**2)
+ assert (2 == ds.minimize(lambda x: (x-2)**2)) == True
46
assert [2, 1] == list(ds.minimize(lambda x, y: (x-2)**2 + (y-1)**2))
0 commit comments