Giter VIP home page Giter VIP logo

Comments (4)

Dr-Irv avatar Dr-Irv commented on August 23, 2024

Can you provide an example?

from pandas-stubs.

bashtage avatar bashtage commented on August 23, 2024
import numpy as np
import pandas as pd

df = pd.DataFrame({"a":[10,20,30], "b":[20,40,60], "c":[30,60,90]})
iloc = np.argmin(np.random.standard_normal(3))
df.iloc[iloc]

produces

exp.py:6: error: No overload variant of "__getitem__" of "_iLocIndexerFrame" matches argument type "signedinteger[_64Bit]"
exp.py:6: note: Possible overload variants:
exp.py:6: note:     def __getitem__(self, Tuple[int, int]) -> Union[str, bytes, date, datetime, timedelta, bool, int, float, complex, Timestamp, Timedelta]
exp.py:6: note:     def __getitem__(self, int) -> Series[Any]
exp.py:6: note:     def __getitem__(self, Tuple[Union[Union[slice, ndarray[Any, dtype[signedinteger[_64Bit]]], Index, List[int], Series[int]], Union[Series[bool], ndarray[Any, dtype[bool_]], List[bool]]], int]) -> Series[Any]
exp.py:6: note:     def __getitem__(self, Tuple[int, Union[Union[slice, ndarray[Any, dtype[signedinteger[_64Bit]]], Index, List[int], Series[int]], Union[Series[bool], ndarray[Any, dtype[bool_]], List[bool]]]]) -> Series[Any]
exp.py:6: note:     def __getitem__(self, Union[Union[slice, ndarray[Any, dtype[signedinteger[_64Bit]]], Index, List[int], Series[int]], Union[Series[bool], ndarray[Any, dtype[bool_]], List[bool]], Tuple[Union[Union[slice, ndarray[Any, dtype[signedinteger[_64Bit]]], Index, List[int], Series[int]], Union[Series[bool], ndarray[Any, dtype[bool_]], List[bool]]], Union[Union[slice, ndarray[Any, dtype[signedinteger[_64Bit]]], Index, List[int], Series[int]], Union[Series[bool], ndarray[Any, dtype[bool_]], List[bool]]]]]) -> DataFrame
Found 1 error in 1 file (checked 1 source file)

from pandas-stubs.

bashtage avatar bashtage commented on August 23, 2024

Needs SupportsInt to handle range of values possible.

These

exp.py:6: note:     def __getitem__(self, Tuple[int, int]) -> Union[str, bytes, date, datetime, timedelta, bool, int, float, complex, Timestamp, Timedelta]
exp.py:6: note:     def __getitem__(self, int) -> Series[Any]

Should probably be something like

exp.py:6: note:     def __getitem__(self, Tuple[typing.SupportsInt, typing.SupportsInt]) -> Union[str, bytes, date, datetime, timedelta, bool, int, float, complex, Timestamp, Timedelta]
exp.py:6: note:     def __getitem__(self, typing.SupportsInt) -> Series[Any]

from pandas-stubs.

bashtage avatar bashtage commented on August 23, 2024
In [7]: isinstance(np.int64(0), typing.SupportsInt)
Out[7]: True

from pandas-stubs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.