You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
importpandasaspdindex=pd.date_range('1/1/2000', periods=9, freq='30S')
series=pd.Series(range(9), index=index).reset_index().drop([4,5]).set_index('index')
print(series.resample('1T').mean()) # Uses NaN as fill_value for minute 2, because there is no data in that minuteprint(series.resample('1T').sum()) # Uses 0 as fill_value for minute 2, which is misleading
Issue Description
I am downsampling with datetime indices where sometimes there are gaps in the timestamps and therefore in those cases there is no data for the aggregate function. I would expect the output to be NaN for these resampled timestamps and this is true for the mean, but the sum function gives 0, which is misleading and ambiguous. Shouldn't it give NaN?
Expected Behavior
I would expect the sum() aggregate function to give as output NaN when there is a resampled timestamp that has no corresponding data in the original series/frame
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
I am downsampling with datetime indices where sometimes there are gaps in the timestamps and therefore in those cases there is no data for the aggregate function. I would expect the output to be NaN for these resampled timestamps and this is true for the mean, but the sum function gives 0, which is misleading and ambiguous. Shouldn't it give NaN?
Expected Behavior
I would expect the sum() aggregate function to give as output NaN when there is a resampled timestamp that has no corresponding data in the original series/frame
Installed Versions
INSTALLED VERSIONS
commit : e8093ba
python : 3.8.13.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-135-generic
Version : #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.3
numpy : 1.22.3
pytz : 2022.5
dateutil : 2.8.2
setuptools : 65.5.0
pip : 22.3
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.4.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.5
brotli :
fastparquet : None
fsspec : None
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.6.1
numba : 0.56.3
numexpr : 2.8.3
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: