numpy practice - Serbipunk/notes GitHub Wiki

mmap

after reading the doc, it seems that this mode would avoid loading the whole file and operate

numpy.load(file, mmap_mode...)

mmap_mode: {โ€˜r+โ€™, โ€˜rโ€™, โ€˜w+โ€™, โ€˜cโ€™}, optional

https://numpy.org/doc/stable/reference/generated/numpy.memmap.html#numpy.memmap

https://numpy.org/doc/stable/reference/generated/numpy.load.html

meshgrid

Return coordinate matrices from coordinate vectors. ไปŽๅๆ ‡ๅ‘้‡๏ผŒ่ฟ”ๅ›žๅๆ ‡็Ÿฉ้˜ต

Make N-D coordinate arrays for vectorized evaluations of ๅˆ›ๅปบ N-D ็ปดๅบฆ็š„ๆ•ฐ็ป„๏ผŒ

N-D scalar/vector fields over N-D grids, given ็”จไบŽ็Ÿข้‡ๅŒ–่ฏ„ไผฐ N-D ่พ“ๅ…ฅ็š„ๆ ‡้‡|ๅ‘้‡๏ผŒ

one-dimensional coordinate arrays x1, x2,..., xn. ่พ“ๅ…ฅไธบๅˆ— | ่กŒๅ‘้‡ใ€‚

ไพ‹ๅญ

image

np.c_

    Translates slice objects to concatenation along the second axis.  ่ฝฌๆขๅˆ‡็‰‡็š„็›ฎๆ ‡๏ผŒๅŽป่ฟžๆŽฅๆˆ็ฌฌไบŒไธช่ฝด๏ผŒ
    This is short-hand for ``np.r_['-1,2,0', index expression]``, 
        which is useful because of its common occurrence    
    In particular, arrays will be stacked along their last axis after being upgraded to at least 2-D with
    1's post-pended to the shape (column vectors made out of 1-D arrays).
    See Also
    --------
    column_stack : Stack 1-D arrays as columns into a 2-D array.
    r_ : For more detailed documentation.
    Examples
    --------
    >>> np.c_[np.array([1,2,3]), np.array([4,5,6])]    # ็œ‹่ฟ™ไธช่ƒฝ็œ‹ๆ‡‚
    array([[1, 4],
           [2, 5],
           [3, 6]])
    >>> np.c_[np.array([1,2,3](/Serbipunk/notes/wiki/1,2,3)), 0, 0, np.array([4,5,6](/Serbipunk/notes/wiki/4,5,6))]
    array([1, 2, 3, ..., 4, 5, 6](/Serbipunk/notes/wiki/1,-2,-3,-...,-4,-5,-6))

np.flipud

ๅ›พ็‰‡