Skip to content

BUG: no last function in window rolling #61310

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

Closed
3 tasks done
algonell opened this issue Apr 19, 2025 · 3 comments
Closed
3 tasks done

BUG: no last function in window rolling #61310

algonell opened this issue Apr 19, 2025 · 3 comments
Labels
Bug Closing Candidate May be closeable, needs more eyeballs Needs Info Clarification about behavior needed to assess issue Window rolling, ewma, expanding

Comments

@algonell
Copy link

algonell commented Apr 19, 2025

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

s = pd.Series(range(5))
s.rolling(3).last()

Issue Description

The reproducible example is right from the docs.
Same goes for agg invocations.

Typical error messages:

  • AttributeError: 'last' is not a valid function for 'Rolling' object
  • AttributeError: 'Rolling' object has no attribute 'last'

Expected Behavior

Last if available.

Installed Versions

commit : 0691c5c
python : 3.13.3
python-bits : 64
OS : Linux
OS-release : 6.14.2-arch1-1
Version : #1 SMP PREEMPT_DYNAMIC Thu, 10 Apr 2025 18:43:59 +0000
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.2.3
numpy : 2.1.3
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : None
sphinx : None
IPython : 9.1.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.4
blosc : None
bottleneck : 1.4.2
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : 1.1
hypothesis : None
gcsfs : None
jinja2 : 3.1.5
lxml.etree : 5.3.2
matplotlib : 3.10.1
numba : 0.61.0
numexpr : 2.10.2
odfpy : None
openpyxl : 3.1.5
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 19.0.1
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.15.2
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : 2.0.1
xlsxwriter : None
zstandard : None
tzdata : 2025.1
qtpy : None
pyqt5 : None

@algonell algonell added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 19, 2025
@chilin0525
Copy link
Contributor

@algonell Are you testing this on the main branch? I can reproduce the code snippet from the documentation and obtain the correct result on the main branch.

@rhshadrach rhshadrach added Needs Info Clarification about behavior needed to assess issue Window rolling, ewma, expanding Closing Candidate May be closeable, needs more eyeballs and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 19, 2025
@algonell
Copy link
Author

@chilin0525 My bad, I am not testing main/latest.

@snitish
Copy link
Member

snitish commented Apr 21, 2025

@algonell The first and last methods were recently added to rolling (#60579). They will be available in pandas 3.0.0

@snitish snitish closed this as completed Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Closing Candidate May be closeable, needs more eyeballs Needs Info Clarification about behavior needed to assess issue Window rolling, ewma, expanding
Projects
None yet
Development

No branches or pull requests

4 participants