How to replace numpy NaNs by last non-NaN value
Usebottleneck.push
:
import bottleneck
y = bottleneck.push(y, axis=0)
If not installed already, you can install bottleneck
using
pip install bottleneck
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow