Skip to content

Mypy complains about slicing a DateTimeIndex #397

Closed
@gandhis1

Description

@gandhis1

Shortened code:

  reveal_type(start) # Union[datetime.datetime, datetime.date, pandas._libs.tslibs.timestamps.Timestamp, None]"
  reveal_type(end)  # Union[datetime.datetime, datetime.date, pandas._libs.tslibs.timestamps.Timestamp, None]"
  concat_df = concat_df.sort_index().loc[start:end, :]

Error:

error: Slice index must be an integer or None

I don't know yet whether this is a stubs issue or potentially a MyPy issue - could even be an issue with my code - I will investigate further

Metadata

Metadata

Assignees

No one assigned

    Labels

    mypy bugRequires mypy to fix a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions