pandas-dev / pandas-stubs

Public type stubs for pandas
BSD 3-Clause "New" or "Revised" License
230 stars 123 forks source link

`__arrow_c_stream__` method on DataFrame #985

Closed kylebarron closed 1 month ago

kylebarron commented 1 month ago

Pandas added support for the Arrow PyCapsule Interface (the __arrow_c_stream__ method) in pandas v2.2. https://github.com/pandas-dev/pandas/pull/56587

This method returns a C PyCapsule, so it's not the types of arguments or return value that matters, it's really just the existence of the method, so that when other libraries expect an object defined as

class ArrowStreamExportable(Protocol):
    def __arrow_c_stream__(
        self,
        requested_schema: object | None = None
    ) -> object:
        ...

then a DataFrame will satisfy the type checker