Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork18.6k
Description
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on thelatest version of pandas.
I have confirmed this bug exists on themain branch of pandas.
Reproducible Example
importpandasaspdimportpymysqlimportopenpyxlfromopenpyxlimportWorkbook,load_workbookfromopenpyxl.stylesimportFont,PatternFillfromopenpyxl.utils.dataframeimportdataframe_to_rowsimportimports_local.mysql_connector_ygreneasmcconn=pymysql.connect(host='localhost',user='user1',password="password1",db='cali',cursorclass=pymysql.cursors.DictCursor )df=pd.read_sql_query('SELECT * FROM sample_data LIMIT 2',conn)print(df)
Issue Description
When using DictCursor the data returned from read_sql_query is just a dataframe of column names. If you change the cursorclass to cursor all is well. I also validated that the issues was not there in 1.5.3. The issue was first noticed in v. 2.0.0 and is there in 2.0.1
Example data output:
id value state_id county_id district_id zipcode plus4
0 id value state_id county_id district_id zipcode plus4
1 id value state_id county_id district_id zipcode plus4
Expected Behavior
id value state_id county_id district_id zipcode plus4
0 117 ABCDEF 5 12 12 95823 6312
1 163 DEFRDC 5 12 12 95814 4713
Installed Versions
INSTALLED VERSIONS
commit :37ea63d
python : 3.11.3.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 2.0.1
numpy : 1.24.2
pytz : 2023.3
dateutil : 2.8.2
setuptools : 65.5.0
pip : 23.1.2
Cython : None
pytest : None
hypothesis : None
...