-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
resampling from Day to BusinessDay pulls weekend data back to friday. #15837
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
possibly related to #10575 |
duplicate of this issue: #11123 |
this is basically a convention. Though I guess it could be regarded as a bug as well. See the discussion on #11123. (and the xref issue you pointed). If you have some thoughts, pls share. |
@jreback I understand that the choice of including Fri-Sat-Sun in Friday period is convention (though as others have pointed out, probably not ideal for time-series analysis given look-forward issues). I think it is then inconsistent that creating a period from a timestamp returns a period for which the timestamp is not included. for example: pd.Period(pd.datetime(2017,1,1), 'B').start_time
# Timestamp('2017-01-02 00:00:00') does the issue i am raising make sense? |
this is just convention (and documented). In the other issue I suggested a new frequency as this looks reasonable actually. I think using
|
cc @chris-b1 |
Code Sample
Problem description
when i have daily data that spans weekends (e.g., 1/1/2017 which is a Sunday) and try to get the last available value for a BusinessDay, the data falls back to the Friday period. This is inconsistent with the timestamp of Sunday belonging to the Monday BusinessDay period (e.g.,
pd.Period('20170101', 'B')
goes to 1/2/2017).Expected Output
I would expect that the
result.index[0]
above would returnPeriod('2017-01-02', 'B')
Output of
pd.show_versions()
pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 34.3.0
Cython: 0.24
numpy: 1.12.0
scipy: 0.18.1
statsmodels: 0.6.1
xarray: 0.9.1
IPython: 4.1.1
sphinx: None
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: None
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.3.3
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: None
lxml: 3.5.0
bs4: 4.5.1
html5lib: None
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.45.0
pandas_datareader: None
The text was updated successfully, but these errors were encountered: