question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TYP: IntervalIndex.right/left might be infered as function

See original GitHub issue
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


import pandas as pd

index: pd.IntervalIndex = pd.IntervalIndex.from_arrays([1], [2])
reveal_type(index)
reveal_type(index.right)
index.right.array

pyright

info: Type of "index" is "IntervalIndex"
info: Type of "index.right" is "() -> Index"
error: Cannot access member "array" for type "function"
    Member "array" is unknown (reportFunctionMemberAccess)

mypy

note: Revealed type is 'pandas.core.indexes.interval.IntervalIndex'
note: Revealed type is 'Any'

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 2cb96529396d93b46abab7bbc73a208e708c642e python : 3.9.4.final.0 python-bits : 64 OS : Linux OS-release : 4.13.0-36-generic Version : #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8

pandas : 1.2.4 numpy : 1.20.3 pytz : 2021.1 dateutil : 2.8.1 pip : 21.0.1 setuptools : 52.0.0 Cython : None pytest : 6.2.4 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : 7.23.1 pandas_datareader: None bs4 : None bottleneck : None fsspec : 2021.05.0 fastparquet : None gcsfs : None matplotlib : 3.4.2 numexpr : 2.7.3 odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyxlsb : None s3fs : None scipy : 1.6.3 sqlalchemy : None tables : 3.6.1 tabulate : None xarray : None xlrd : None xlwt : None numba : None

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
simonjayhawkinscommented, Sep 4, 2021

These errors were not triggered before because anything that uses @cache_readonly resulted in type Any.

applies to all untyped decorators, xref #33455

1reaction
twoertweincommented, Sep 3, 2021

@hauntsaninja I think you are right 😃 There are still many mypy errors but they are actually legitimate errors. These errors were not triggered before because anything that uses @cache_readonly resulted in type Any.

I think the best way forward is to fix the many type errors uncovered through this and then lie to mypy (cache_readonly = property)

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.IntervalIndex — pandas 1.5.2 documentation
Whether the intervals are closed on the left-side, right-side, both or neither. If None, dtype will be inferred. Copy the input data.
Read more >
core/arrays/interval.py · arcadiapower/pandas - Gemfury
... default None If None, dtype will be inferred. .. versionadded:: 0.23.0 copy ... interval_range : Function to create a fixed frequency IntervalIndex....
Read more >
pyspark: ValueError: Some of types cannot be determined ...
In order to infer the field type, PySpark looks at the non-none records in each field. If a field only has None records,...
Read more >
interval.py
We can't create # a new IA from an (empty) object-dtype array, so turn it into the ... interval_range : Function to create...
Read more >
Python | Pandas dataframe.infer_objects() - GeeksforGeeks
infer_objects() function attempts to infer better data type for input object column. This function attempts soft conversion of object-dtyped ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found