Closed as not planned
Description
Bug Report
Incorrect type inference for annotated pandas functions
Example Code
import sqlite3
import pandas as pd
def load_excel() -> pd.DataFrame:
df = pd.read_excel('example.xlsx')
return df
def load_sql() -> pd.DataFrame:
con = sqlite3.Connection('a.db')
df = pd.read_sql('', con)
return df
Expected Behavior
Return type should be DataFrame
(not Any
), as that is the source code annotation for read_excel
and read_sql
.
Actual Behavior
Your Environment
- Mypy version used: 0.961
- Mypy command-line flags: None
- Mypy configuration options: file attached
- Python version used: 3.10
- Operating system and version: Windows 10 21H2