Pandas version checks

  • [X] I have checked that this issue has not already been reported.

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

  • [ ] I have confirmed this bug exists on the [main branch] (https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas.

Reproducible Example

from pandas.core.dtypes.cast import find_common_type

Issue Description

The above code runs when executed with python, but while checking for types with mypy, I get the error

error: Module "pandas.core.dtypes.cast" has no attribute "find_common_type"  [attr-defined]
Found 1 error in 1 file (checked 1 source file)

Commands run pip install mypy mypy file.py

Expected Behavior

Mypy check should pass

Installed Versions

INSTALLED VERSIONS ------------------ commit : 8dab54d6573f7186ff0c3b6364d5e4dd635ff3e7 python : 3.8.15.final.0 python-bits : 64 OS : Linux OS-release : 5.4.0-136-generic Version : #153-Ubuntu SMP Thu Nov 24 15:56:58 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US LOCALE : en_US.ISO8859-1 pandas : 1.5.2 numpy : 1.24.1 pytz : 2022.7 dateutil : 2.8.2 setuptools : 65.6.3 pip : 22.3.1 Cython : 0.29.33 pytest : 7.2.0 hypothesis : None sphinx : 6.1.3 blosc : None feather : 0.4.1 xlsxwriter : None lxml.etree : 4.9.2 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.8.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : None brotli : None fastparquet : 2022.12.0 fsspec : 2022.11.0 gcsfs : None matplotlib : 3.6.2 numba : None numexpr : 2.8.4 odfpy : None openpyxl : 3.0.10 pandas_gbq : 0.18.1 pyarrow : 10.0.1 pyreadstat : None pyxlsb : None s3fs : 2022.11.0 scipy : 1.10.0 snappy : None sqlalchemy : 1.4.46 tables : 3.8.0 tabulate : None xarray : 2022.12.0 xlrd : 2.0.1 xlwt : None zstandard : None tzdata : None

My mypy version is mypy 0.991 .

Comment From: phofl

Hi, thanks for your report. This needs more information. Is this within our development code base or are you trying this as a pandas user?

Comment From: arunjose696

Trying this as a pandas user.

Comment From: phofl

This is not a public area of our code base, so this is not expected to work