Skip to content

Resampling data #210

Answered by kernc
jamhot1 asked this question in Q&A
Dec 27, 2020 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Checking for nan should be done with numpy.isnan() as nans are a particularly curious bunch:

>>> float('nan') == float('nan')
False
>>> import numpy as np
>>> np.nan == np.nan
False

But more importantly, why not simply use Series.ffill()?

>>> pd.Series([1, np.nan, np.nan, 2, np.nan]).ffill().tolist()
[1, 1, 1, 2, 2]

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@jamhot1
Comment options

@jamhot1
Comment options

@kernc
Comment options

@jamhot1
Comment options

@kernc
Comment options

Answer selected by jamhot1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants