facebook / facebook/pyrefly

Pandas locindexer for dataframes inspected as unknown

Open
#1,678 1 comment 0 reactions 1 assignee Claimed by @asukaminato0721 View on GitHub
dataframe overloads typechecking
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

For series this is correctly inferred:

Image

But for dataframes it's simply `Unknown`:

Image

Shouldn't the second signature match `Callable`, second from the bottom in this signature?

```python
class _LocIndexerFrame(_LocIndexer, Generic[_T]):
@overload
def __getitem__(self, idx: Scalar) -> Series | _T: ...
@overload
def __getitem__( # type: ignore[overload-overlap]
self,
idx: (
IndexType
| MaskType
| Callable[[DataFrame], IndexType | MaskType | Sequence[Hashable]]
| list[HashableT]
| tuple[
IndexType
| MaskType
| list[HashableT]
| slice
| _IndexSliceTuple
| Callable,
MaskType | list[HashableT] | IndexType | Callable,
]
),
) -> _T: ...
...
```

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.