We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
# Your code here df = pd.DataFrame({"column1": range(6), "column2": range(6), 'group': 3*['A','B'], 'date':pd.date_range("20190101", periods=6)}) df.loc[:,'date']=df.loc[0,'date'] df ### Output column1 column2 group date 0 0 0 A 2019-01-01 1 1 1 B 2019-01-01 2 2 2 A 2019-01-01 3 3 3 B 2019-01-01 4 4 4 A 2019-01-01 5 5 5 B 2019-01-01 df.groupby('group').rolling('1D',on='date',closed='left')['column1'].sum() ### Output ValueError: closed only implemented for datetimelike and offset based windows
Closed parameter not producing the result as it should. Only closed='both' is working.
Current workaround as follows (but considerably slower):
df.groupby('group').apply(lambda x: x.rolling('1D',on='date',closed='left')['column1'].sum())
group date A 2019-01-01 NaN 2019-01-01 0.0 2019-01-01 2.0 B 2019-01-01 NaN 2019-01-01 1.0 2019-01-01 4.0 Name: column1, dtype: float64
Name: column1, dtype: float64
pd.show_versions()
commit : d9fff27 python : 3.8.5.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.18362 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United States.1252
pandas : 1.1.0 numpy : 1.18.5 pytz : 2020.1 dateutil : 2.8.1 pip : 20.2.1 setuptools : 49.2.1.post20200802 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 2.11.2 IPython : 7.17.0 pandas_datareader: None bs4 : 4.9.1 bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : 3.3.0 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 1.0.0 pytables : None pyxlsb : None s3fs : None scipy : 1.5.0 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : 0.48.0
The text was updated successfully, but these errors were encountered:
mroeschke
Successfully merging a pull request may close this issue.
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.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
Closed parameter not producing the result as it should. Only closed='both' is working.
Current workaround as follows (but considerably slower):
Expected Output
Name: column1, dtype: float64
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : d9fff27
python : 3.8.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.1.0
numpy : 1.18.5
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.1
setuptools : 49.2.1.post20200802
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.17.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 1.0.0
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.48.0
The text was updated successfully, but these errors were encountered: