@@ -2163,15 +2163,15 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
2163
2163
2164
2164
< pre > < code class ="python language-python hljs "> <array> = np.array(<list/list_of_lists>) < span class ="hljs-comment "> # Returns a 1d/2d NumPy array.</ span >
2165
2165
<array> = np.zeros/ones(<shape>) < span class ="hljs-comment "> # Also np.full(<shape>, <el>).</ span >
2166
- <array> = np.arange(from_inc, to_exc, ±step) < span class ="hljs-comment "> # Also np.linspace(start, stop, num ).</ span >
2166
+ <array> = np.arange(from_inc, to_exc, ±step) < span class ="hljs-comment "> # Also np.linspace(start, stop, len ).</ span >
2167
2167
<array> = np.random.randint(from_inc, to_exc, <shape>) < span class ="hljs-comment "> # Also np.random.random(<shape>).</ span >
2168
2168
</ code > </ pre >
2169
2169
< pre > < code class ="python language-python hljs "> <view> = <array>.reshape(<shape>) < span class ="hljs-comment "> # Also `<array>.shape = <shape>`.</ span >
2170
- <array> = <array>.flatten() < span class ="hljs-comment "> # Collapses array into one dimension .</ span >
2171
- <view> = <array>.squeeze () < span class ="hljs-comment "> # Removes dimensions of length one .</ span >
2170
+ <array> = <array>.flatten() < span class ="hljs-comment "> # Also `<view> = <array>.ravel()` .</ span >
2171
+ <view> = <array>.transpose () < span class ="hljs-comment "> # Also `<view> = <array>.T` .</ span >
2172
2172
</ code > </ pre >
2173
- < pre > < code class ="python language-python hljs "> <array> = <array>.sum/min/mean/var/std([axis] ) < span class ="hljs-comment "> # Passed dimension gets aggregated .</ span >
2174
- <array> = <array>.argmin ([axis]) < span class ="hljs-comment "> # Returns indexes of smallest elements .</ span >
2173
+ < pre > < code class ="python language-python hljs "> <array> = np.copy/int64/float64( <array>) < span class ="hljs-comment "> # Returns new array of the same shape .</ span >
2174
+ <array> = <array>.sum/max/mean/argmax/all ([axis]) < span class ="hljs-comment "> # Passed dimension gets aggregated .</ span >
2175
2175
<array> = np.apply_along_axis(<func>, axis, <array>) < span class ="hljs-comment "> # Func can return a scalar or array.</ span >
2176
2176
</ code > </ pre >
2177
2177
< ul >
0 commit comments