Before version 2.0.0 I was able to resample an empty DataFrame with DateTimeIndex. Now it leads to a ValueError
. Is that on purpose or a bug?
Comment From: MarcoGorelli
can you show a reproducible example please?
Comment From: ASchueddekopf
If you create a python file with the following code it will result in a df with 15 min frequency datetimeIndex with pandas version 1.5.2 and a value error with pandas 2.0.0:
import datetime
import pandas as pd
def main():
year = 2018
freq = "1H"
index = pd.date_range(
start=datetime.datetime(year, 1, 1),
end=datetime.datetime(year + 1, 1, 1),
freq=freq,
)
index = index[:-1]
index = pd.to_datetime(index)
df = pd.DataFrame(index=index)
df.resample("15Min").mean()
if __name__ == "__main__":
main()
Comment From: MarcoGorelli
thanks
looks like this was introduced by https://github.com/pandas-dev/pandas/pull/47672 cc @mroeschke @rhshadrach @ahmedibrhm
https://www.kaggle.com/code/marcogorelli/pandas-regression-example/notebook?scriptVersionId=125373741