Skip to content

Fix cbusday calendar Typecheck v2 #62014

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

Open
wants to merge 192 commits into
base: main
Choose a base branch
from

Conversation

prblydv
Copy link

@prblydv prblydv commented Jul 31, 2025

Initial Bug

Passing an object like NYSEExchangeCalendar to CustomBusinessDay(calendar=...) failed or behaved unexpectedly and showed new years day as buissnesssday, because the code accepted non-busdaycalendar types without raising an error.

Fix

As Richard Shadrach posted it should raise a typerror i implemented a TypeError' check and this PR adds a type check in _get_calendar()to raise aTypeErrorif thecalendarargument is not an instance ofnp.busdaycalendar`.

Test

A new test was added in test_custom_business_day.py to confirm that a TypeError is raised when an invalid calendar object is passed.

I realize the previous version may have sounded AI-generated. This revised PR is fully authored by me, happy to answer any questions or make changes as needed.

Pandas Development Team and others added 30 commits December 22, 2023 11:18
…used fixture) (pandas-dev#56612)

Backport PR pandas-dev#56595: TST/CLN: Inline seldom used fixture

Co-authored-by: Matthew Roeschke <[email protected]>
…nings) (pandas-dev#56620)

Backport PR pandas-dev#56615: CI: Fix deprecation warnings

Co-authored-by: Patrick Hoefler <[email protected]>
…from ruff) (pandas-dev#56624)

Backport PR pandas-dev#56617: TYP: some return types from ruff

Co-authored-by: Torsten Wörtwein <[email protected]>
…e) (pandas-dev#56639)

Backport PR pandas-dev#56636: DOC: Fixup CoW userguide

Co-authored-by: Patrick Hoefler <[email protected]>
….2.0 whatsnew) (pandas-dev#56640)

Backport PR pandas-dev#56632: DOC: Minor fixups for 2.2.0 whatsnew

Co-authored-by: Richard Shadrach <[email protected]>
…ising for arrow floats to numpy floats) (pandas-dev#56648)

Backport PR pandas-dev#56644: BUG: Series.to_numpy raising for arrow floats to numpy floats

Co-authored-by: Patrick Hoefler <[email protected]>
…ds for pyarrow duration types) (pandas-dev#56656)

Backport PR pandas-dev#56650: ENH: Implement dt methods for pyarrow duration types

Co-authored-by: Matthew Roeschke <[email protected]>
…values) (pandas-dev#56655)

Backport PR pandas-dev#56647: floordiv fix for large values

Co-authored-by: rohanjain101 <[email protected]>
… merging datetime columns with timedelta columns) (pandas-dev#56658)

Backport PR pandas-dev#56613: BUG: Added raising when merging datetime columns with timedelta columns

Co-authored-by: Huanghz2001 <[email protected]>
… MultiIndex raising read-only error) (pandas-dev#56660)

Backport PR pandas-dev#56635: CoW: Boolean indexer in MultiIndex raising read-only error

Co-authored-by: Patrick Hoefler <[email protected]>
…dencies table in 2.2 whatsnew) (pandas-dev#56662)

Backport PR pandas-dev#56641: DOC: Add optional dependencies table in 2.2 whatsnew

Co-authored-by: Matthew Roeschke <[email protected]>
…ime ArrowDtype) (pandas-dev#56665)

Backport PR pandas-dev#56370: BUG: rolling with datetime ArrowDtype

Co-authored-by: Matthew Roeschke <[email protected]>
…l not properly respecting check-dtype) (pandas-dev#56668)

Backport PR pandas-dev#56654: BUG: assert_series_equal not properly respecting check-dtype

Co-authored-by: Patrick Hoefler <[email protected]>
…ranch) (pandas-dev#56669)

Backport PR pandas-dev#56664: CI: Run jobs on 2.2.x branch

Co-authored-by: Matthew Roeschke <[email protected]>
…f pygrep check for future annotation import) (pandas-dev#56683)

Backport PR pandas-dev#56666: STY: Use ruff instead of pygrep check for future annotation import

Co-authored-by: Matthew Roeschke <[email protected]>
…oncat regression) (pandas-dev#56686)

Backport PR pandas-dev#56312: DOC: Add whatsnew for concat regression

Co-authored-by: Thomas Li <[email protected]>
…owed in Series.struct.field) (pandas-dev#56698)

Backport PR pandas-dev#56167: [ENH]: Expand types allowed in Series.struct.field

Co-authored-by: Tom Augspurger <[email protected]>
…ion of str.fullmatch matches partial string. issue pandas-dev#56652) (pandas-dev#56715)

Backport PR pandas-dev#56691: Bug pyarrow implementation of str.fullmatch matches partial string. issue pandas-dev#56652

Co-authored-by: JackCollins91 <[email protected]>
…warning on coerce) (pandas-dev#56719)

Backport PR pandas-dev#56699: DOC: Corrected typo in warning on coerce

Co-authored-by: aaron-robeson-8451 <[email protected]>
…EA ffill/bfill) (pandas-dev#56720)

Backport PR pandas-dev#56616: BUG: Add limit_area to EA ffill/bfill

Co-authored-by: Richard Shadrach <[email protected]>
…string) (pandas-dev#56725)

Backport PR pandas-dev#56721: DOC: Fixup read_csv docstring

Co-authored-by: Patrick Hoefler <[email protected]>
…type categorical using dictionary as categories) (pandas-dev#56723)

Backport PR pandas-dev#56672: BUG: dictionary type astype categorical using dictionary as categories

Co-authored-by: Patrick Hoefler <[email protected]>
…or read_excel) (pandas-dev#56730)

Backport PR pandas-dev#56543: DOC: Update docstring for read_excel

Co-authored-by: Patrick Hoefler <[email protected]>
…d floordiv for pyarrow types with large divisor and avoid floating points for floordiv) (pandas-dev#56744)

Backport PR pandas-dev#56677: Fix integral truediv and floordiv for pyarrow types with large divisor and avoid floating points for floordiv

Co-authored-by: rohanjain101 <[email protected]>
…ata preservation in groupby column selection) (pandas-dev#56770)

Backport PR pandas-dev#56761: BUG: fix subclass metadata preservation in groupby column selection

Co-authored-by: Joris Van den Bossche <[email protected]>
…loats with bools for ea dtypes) (pandas-dev#56780)

Backport PR pandas-dev#56769: BUG: replace matching Floats with bools for ea dtypes

Co-authored-by: Patrick Hoefler <[email protected]>
…ng for nullable bool dtype) (pandas-dev#56782)

Backport PR pandas-dev#56767: BUG: Series.round raising for nullable bool dtype

Co-authored-by: Patrick Hoefler <[email protected]>
…ing ea dtypes correctly) (pandas-dev#56783)

Backport PR pandas-dev#56771: BUG: to_stata not handling ea dtypes correctly

Co-authored-by: Patrick Hoefler <[email protected]>
meeseeksmachine and others added 28 commits May 14, 2024 12:58
…y_index_types due to new 2024.5 release) (pandas-dev#58720)

Backport PR pandas-dev#58719: CI: xfail test_to_xarray_index_types due to new 2024.5 release

Co-authored-by: Matthew Roeschke <[email protected]>
…te locators for DatetimeIndex plotting) (pandas-dev#59002)

Backport PR pandas-dev#58992: PERF: cache plotting date locators for DatetimeIndex plotting

Co-authored-by: Matthew Roeschke <[email protected]>
…t_to_xarray_index_types ) (pandas-dev#59015)

Backport PR pandas-dev#59013: CI: remove xfail in test_to_xarray_index_types

Co-authored-by: Abdulaziz Aloqeely <[email protected]>
…s for SciPy 1.14.0) (pandas-dev#59104)

Backport PR pandas-dev#59094: BUG: Fix sparse doctests for SciPy 1.14.0

Co-authored-by: Lysandros Nikolaou <[email protected]>
…s to work for any module that raises an exception) (pandas-dev#59158)

Backport PR pandas-dev#59114: BUG: Allow show_versions to work for any module that raises an exception

Co-authored-by: Matthew Roeschke <[email protected]>
…g in matplotlib test) (pandas-dev#59175)

Backport PR pandas-dev#59168: TST: Address UserWarning in matplotlib test

Co-authored-by: Matthew Roeschke <[email protected]>
…gcs for pyarrow=17) (pandas-dev#59308)

Backport PR pandas-dev#59306: CI: xfail test_to_read_gcs for pyarrow=17

Co-authored-by: Matthew Roeschke <[email protected]>
…imedelta * DateOffset) (pandas-dev#59444)

Backport PR pandas-dev#59441: COMPAT: Fix numpy 2.1 timedelta * DateOffset

Co-authored-by: Matthew Roeschke <[email protected]>
…failures) (pandas-dev#59550)

Backport PR pandas-dev#59545: CI: Fix ci for numpy 2 failures

Co-authored-by: Patrick Hoefler <[email protected]>
…ests (pandas-dev#59570)

* Backport PR pandas-dev#59553: CI: Uninstall nomkl & 32 bit Interval tests

* Update pandas/tests/indexes/interval/test_interval_tree.py

* Update pandas/tests/indexes/interval/test_interval_tree.py

* Update pandas/tests/indexing/interval/test_interval_new.py

* Update pandas/tests/indexing/interval/test_interval_new.py
…2.2.3) (pandas-dev#59812)

Backport PR pandas-dev#59811: DOC: add whatsnew for v2.2.3

Co-authored-by: Joris Van den Bossche <[email protected]>
…motion_state usage) (pandas-dev#59821)

BUG: Remove np._get_promotion_state usage (pandas-dev#59818)

(cherry picked from commit 081dcde)

Co-authored-by: Lysandros Nikolaou <[email protected]>
…uilds) (pandas-dev#59828)

Backport PR pandas-dev#59813: CI: Debug failing ARM builds

Co-authored-by: Thomas Li <[email protected]>
…olve pandas-dev#2137) (pandas-dev#59535)

* remove core.computation.ops.Div resolves pandas-dev#21374 pandas-dev#58748

* need to preserve order

* updating tests

* (update whatsnew -- no whatsnew for 2.2.x and 2.3 yet)

* solve mypy issue

* fixing pytests

* better than cast

* adding specific test

(* Update pandas/tests/frame/test_query_eval.py // Not backported, fails on 2.2)



* Update pandas/tests/computation/test_eval.py



---------

Co-authored-by: Laurent Mutricy <[email protected]>
Co-authored-by: Matthew Roeschke <[email protected]>
Co-authored-by: Thomas Li <[email protected]>
* Backport PR pandas-dev#59065: ENH: Fix Python 3.13 test failures & enable CI

* Remove deprecated plot_date calls (pandas-dev#58484)

* Remove deprecated plot_date calls

These were deprecated in Matplotlib 3.9.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit c9bc480)

* Pick out fastparquet xfails for green CI

* pin pytz to fix test_arrays.py

* more workflow tweaks for pytz and Python 3.13

* fix typing and tune tests for copy on write

* remove WASM stuff

* more arm skips

* go for green

---------

Co-authored-by: Lysandros Nikolaou <[email protected]>
Co-authored-by: Elliott Sales de Andrade <[email protected]>
…otation) (pandas-dev#59837)

Backport PR pandas-dev#59836: BLD: Fix bad Cython annotation

Co-authored-by: Thomas Li <[email protected]>
…aded nightly wheels) (pandas-dev#59835)

* Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 (pandas-dev#59208)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.19.1 to 2.19.2.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](pypa/cibuildwheel@v2.19.1...v2.19.2)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit ad09dc6)

* Upload 3.13 & free-threaded nightly wheels (pandas-dev#59136)

* Upload free-threaded nightly wheels on Linux and macOS

* Consolidate jobs into one

* Install build dependencies in before-build and pass --no-build-isolation

* Fix {project} placeholder in cibuildwheel config

* Correctly quote echo CIBW_BUILD_FRONTEND command

* Run echo -e

* Add {package} to before-build

* Include cibw script in sdist & add matrix value for build frontend

* Change manifest and gitattributes

* Change gitattributes

* Install verioneer in before-build

* Add cibw_before_test to install nightly NumPy

* Expand before-test to musl

* Better comments plus always run before-build/before-test on 3.13

* Add --no-build-isolation in 3.13 as well

* Install nightly numpy before windows tests

* Address feedback; add todo for NumPy nightly and move default outside matrix

* Set build_frontend to 'build' in pyodide build

---------

Co-authored-by: Matthew Roeschke <[email protected]>
(cherry picked from commit 7c0ee27)

* CI: Update to cibuildwheel 2.20.0 (pandas-dev#59401)

cibuildwheel 2.20.0 uses the ABI stable Python 3.13.0rc1 and build Python 3.13 wheels by default, which allows removing the `CIBW_PRERELEASE_PYTHONS` flag.

Co-authored-by: Matthew Roeschke <[email protected]>
(cherry picked from commit 70bb855)

* Update wheels.yml

* BLD/RLS: build wheels with released numpy/cython for Python 3.13 (pandas-dev#59819)

(cherry picked from commit 2237217)

* enable prerelease again

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <[email protected]>
Co-authored-by: Ewout ter Hoeven <[email protected]>
Co-authored-by: Thomas Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: CustomBusinessDay not respecting calendar