python - Resampling Pandas Series with integer index (add missing index) -
i have pandas series s = pd.series({1: 10, 2:11, 4:5, 7:10})
1 10 2 11 4 5 7 10 dtype: int64
i resample serie in order serie that
1 10 2 11 3 0 4 5 5 0 6 0 7 10 dtype: int64
if got serie programm/another part of code, try:
max_range = max(s.index) + 1 s = s.reindex(index=range(1, max_range), fill_value=0)
Comments
Post a Comment