Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative solution to exercise 4 #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 100_Numpy_exercises_with_hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ File automatically generated. See the documentation to update questions/answers/
#### 3. Create a null vector of size 10 (★☆☆)
`hint: np.zeros`
#### 4. How to find the memory size of any array (★☆☆)
`hint: size, itemsize`
`hint: size, itemsize, nbytes`
#### 5. How to get the documentation of the numpy add function from the command line? (★☆☆)
`hint: np.info`
#### 6. Create a null vector of size 10 but the fifth value which is 1 (★☆☆)
Expand Down Expand Up @@ -247,4 +247,4 @@ np.sqrt(-1) == np.emath.sqrt(-1)
#### 99. Given an integer n and a 2D array X, select from X the rows which can be interpreted as draws from a multinomial distribution with n degrees, i.e., the rows which only contain integers and which sum to n. (★★★)
`hint: np.logical_and.reduce, np.mod`
#### 100. Compute bootstrapped 95% confidence intervals for the mean of a 1D array X (i.e., resample the elements of an array with replacement N times, compute the mean of each sample, and then compute percentiles over the means). (★★★)
`hint: np.percentile`
`hint: np.percentile`
6 changes: 3 additions & 3 deletions 100_Numpy_exercises_with_hints_with_solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ Z = np.zeros(10)
print(Z)
```
#### 4. How to find the memory size of any array (★☆☆)
`hint: size, itemsize`
`hint: size, itemsize, nbytes`

```python
Z = np.zeros((10,10))
print("%d bytes" % (Z.size * Z.itemsize))
print("%d bytes (%d bytes, using "nbytes")" % ((Z.size * Z.itemsize), Z.nbytes))
```
#### 5. How to get the documentation of the numpy add function from the command line? (★☆☆)
`hint: np.info`
Expand Down Expand Up @@ -1205,4 +1205,4 @@ idx = np.random.randint(0, X.size, (N, X.size))
means = X[idx].mean(axis=1)
confint = np.percentile(means, [2.5, 97.5])
print(confint)
```
```
4 changes: 2 additions & 2 deletions 100_Numpy_exercises_with_solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ print(Z)

```python
Z = np.zeros((10,10))
print("%d bytes" % (Z.size * Z.itemsize))
print("%d bytes (%d bytes, using "nbytes")" % ((Z.size * Z.itemsize), Z.nbytes))
```
#### 5. How to get the documentation of the numpy add function from the command line? (★☆☆)

Expand Down Expand Up @@ -1205,4 +1205,4 @@ idx = np.random.randint(0, X.size, (N, X.size))
means = X[idx].mean(axis=1)
confint = np.percentile(means, [2.5, 97.5])
print(confint)
```
```