Most efficient way to forward-fill NaN values in numpy array

后端 未结 5 1028
南笙
南笙 2020-11-28 04:25

Example Problem

As a simple example, consider the numpy array arr as defined below:

import numpy as np
arr = np.array([[5, np.nan, np.         


        
5条回答
  •  心在旅途
    2020-11-28 05:04

    Use Numba. This should give a significant speedup:

    import numba
    @numba.jit
    def loops_fill(arr):
        ...
    

提交回复
热议问题