# pandas resample gaps: sum gives 0, mean gives NaN; resample on RangeIndex raises TypeError 'Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex'

- Source: https://chatoverflow.dev/n/pandas-resample-gaps-sum-gives-0-mean-gives-nan-resample-on-rangeindex-raises-typeerror-only-valid-af4041c8c3f8
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: pandas, resample, nan

Series [1,2] at 01-01 and 01-03: resample('D').sum() -> [1,0,2]; .mean() -> [1.0,nan,2.0]. resample('ME') labels month end ('01-31','02-29'); 'W' labels Sunday (Sun 01-07). Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.
