__init__.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:heliopy 作者: heliopython 项目源码 文件源码
def interweave(a, b):
    """
    given two array-like variables interweave them together.
    Discussed here: http://stackoverflow.com/questions/5347065/interweaving-two-numpy-arrays

    Parameters
    ==========
    a : array-like
        first array

    b : array-like
        second array

    Returns
    =======
    out : numpy.ndarray
        interweaved array
    """
    a = np.asanyarray(a)
    b = np.asanyarray(b)
    ans = np.empty((a.size + b.size), dtype=a.dtype)
    ans[0::2] = a
    ans[1::2] = b
    return ans
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号