numpy_exercises
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
numpy_exercises [2020/10/17 19:15] – created prasanthi | numpy_exercises [2020/10/25 04:39] (current) – prasanthi | ||
---|---|---|---|
Line 2: | Line 2: | ||
Q. Given two one dimensional arrays, how to combine them into a 2d numpy array? | Q. Given two one dimensional arrays, how to combine them into a 2d numpy array? | ||
- | A. use numpy.column_stack() | + | A. use < |
< | < | ||
Line 33: | Line 33: | ||
2 | 2 | ||
</ | </ | ||
+ | You can also get the same result by doing < | ||
+ | |||
+ | < | ||
+ | In [4]: | ||
+ | m2 = np.vstack((c1, | ||
+ | m2 | ||
+ | Out[4]: | ||
+ | array([[0.39656302, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | In [5]: | ||
+ | np.array_equal(m, | ||
+ | Out[5]: | ||
+ | True | ||
+ | </ | ||
+ | |||
+ | Ref:- | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | tags | combine two numpy arrays into 2d array | ||
+ |
numpy_exercises.1602962153.txt.gz · Last modified: 2020/10/17 19:15 by prasanthi