Skip to content
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

FutureWarning for XKRX #300

Open
maread99 opened this issue Apr 8, 2023 · 1 comment
Open

FutureWarning for XKRX #300

maread99 opened this issue Apr 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@maread99
Copy link
Collaborator

maread99 commented Apr 8, 2023

The test TestXKRXCalendar.test_feb_29_2022_in_lunar_calendar results in 6 instances of the following deprecation warning:

...\exchange_calendars\exchange_calendars\pandas_extensions\korean_holiday.py:76: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
    dt = pd.Timestamp(dt)

It seems to be due to a DatetimeIndex being passed to the dt parameter of the alternative_holiday function which is being called for the IndependenceMovementDay holiday, although it's not clear to me why it's receiving a DatetimeIndex.

It could be silenced with no change in behaviour, and the eventual bug when it is deprecated could be avoided, by changing this line from:

if dt >= since:

to:

if isinstance(dt, pd.Timestamp) and dt >= since:

Although this change would cause no change in behavior (as is, with a DatetimeIndex it evaluates to False as it's ambiguous), I haven't changed it because it would just hide the real issue which is that alternative_holiday is getting a DatetimeIndex when it seems to be expecting a Timestamp.

@maread99
Copy link
Collaborator Author

maread99 commented Apr 9, 2023

This issue is also mentioned in #128.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant