Python 为什么在获取数据时使用NAN值?

Python 为什么在获取数据时使用NAN值?,python,mysql,pandas,sqlalchemy,Python,Mysql,Pandas,Sqlalchemy,执行此代码后,我将获得所有列的NAN值。为什么?我想我之所以得到NAN值是因为read\u sql(),我使用了read\u sql\u table()并得到了非NAN输出,当我对现有值使用read\u sql()时,我也得到了NAN值,但现在对现有值使用read\u sql\u table()后,我没有得到任何NAN值。你确定,有一个结果不是空值吗。请在代码中添加错误处理是的,我确定,我已经在mysql workbench中进行了检查,我正在那里获取数据。欢迎使用StackOverflow。t

执行此代码后,我将获得所有列的NAN值。为什么?

我想我之所以得到NAN值是因为read\u sql(),我使用了read\u sql\u table()并得到了非NAN输出,当我对现有值使用read\u sql()时,我也得到了NAN值,但现在对现有值使用read\u sql\u table()后,我没有得到任何NAN值。

你确定,有一个结果不是空值吗。请在代码中添加错误处理是的,我确定,我已经在mysql workbench中进行了检查,我正在那里获取数据。欢迎使用StackOverflow。tbl_商店_库存是什么样子的?如果您在不同的程序(如DB IDE)中查看该表,列中是否有条目?嘿!欢迎:)您已经使用了read\u sql(),我相信这是read\u sql\u表和read\u sql\u查询的包装器。您提供了一个查询,据我所知,read\u sql()将使用read\u sql\u query()。我认为这会减少正确计算要使用的数据类型的工作量。在运行select*from tbl_store_INTABLE时,您可以尝试读取sql_table(table_name='tbl_store_INTABLE',con=db_connection)?是有4列,StoreID、BatchID、QUOTE、Location,是每列都有各自的数据
from sqlalchemy import create_engine
import pymysql
import pandas as pd

db_connection_str='mysql+pymysql://username:pwd@Host/DB'
db_connection = create_engine(db_connection_str)

df = pd.read_sql('select * from tbl_store_inventory', con=db_connection)
print(df)