-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: resampling error when date_range includes a single DST #35219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The issue is possibly around here 1090 # if we have the same frequency as our axis, then we are equal sampling
1091 if limit is None and to_offset(ax.inferred_freq) == self.freq:
1092 result = obj.copy()
-> 1093 result.index = res_index
1094 else:
1095 result = obj.reindex(
1096 res_index, method=method, limit=limit, fill_value=fill_value
1097 ) Do we also need a length check in that if condition? Can you investigate @Flix6x? |
And given the discussion in #35248, is this a duplicate or distinct? |
Adding the length check I would have actually expected the preceding offset comparison to fail:
To me, adding the length check remedies a symptom of maintaining this equality. Both This issue is distinct from #35248, and both are symptoms of #22864. Your suggested fix would resolve this issue (which deals with offsets only), but not #35248 (which deals with pandas offsets versus datetime timedeltas). Would you like me to make a pull request (with or without test)? |
That'd be great (including a test). |
yeah we had quite some discussion about #22864 and actually @mroeschke pushed a patch, but its too big of a change to do in a minor release; we would have to wait till 2.0 for this. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
In my first example, resampling from an offset of 1 day to an offset of 24 hours works as expected, but only when the start and end of the DatetimeIndex share the same timezone. In my second example the date range start and ends in a different timezone due to a daylight savings transition on 29 March 2020, for which resampling to 24 hours fails.
Possibly related issue:
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.7.final.0
python-bits : 64
OS : Linux
OS-release : 4.9.0-11-amd64
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.5
numpy : 1.19.0
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 47.3.1.post20200622
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: