Skip to content

FutureWarning for XKRX #300

@maread99

Description

@maread99

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions