forked from agramfort/datacamp-assignment1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
numpy_questions.py
46 lines (33 loc) · 873 Bytes
/
numpy_questions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# noqa: D100
import numpy as np
def max_index(X):
"""Return the index of the maximum in a numpy array.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
The input array.
Returns
-------
i : int
The row index of the maximum.
j : int
The column index of the maximum.
Raises
------
ValueError
If the input is not a numpy error or
if the shape is not 2D.
"""
i = 0
j = 0
# TODO
return i, j
def wallis_product(n_terms):
"""Implement the Wallis product to compute an approximation of pi.
See:
https://en.wikipedia.org/wiki/Wallis_product
XXX : write Parameters and Returns sections as above.
"""
# XXX : The n_terms is an int that corresponds to the number of
# terms in the product. For example 10000.
return 0.