Skip to content

Date comparison error if all dates expired #5

Description

@amhanson9

With the function check_dates(), I discovered during unit testing that if every date is in the past, it was classified as a pandas timestamp (class pandas._libs.tslibs.timestamps.Timestamp. This was causing the dates to be classified as nondate, giving the following error: AttributeError: Can only use .str accessor with string values!

I added the pandas timestamp to determining if something is a date. Even though the expired dates are in df_date, and df_nondate is empty, it still gives the AttributeError from the line df_nondate.loc[df_nondate['Review_Date'].str.lower()... This is not a problem for the unit test that is all future dates, which also has an empty datatframe for df_nondate.

In practice, this is unlikely to happen. The dataframe is every row from every share inventory, so there will be some dates in the future and some dates that are text. For now, I'll keep a permanent date in the test for dates_expired. Try to figure it out later in case it is pointing to a problem I'm missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions