[英]Dask + PostgreSQL read_sql_table: incorrect data type index_col
[英]Pass multiple column names as input to the parameter index_col using the function dask.dataframe.read_sql_table to create a dask dataframe
有了这个我得到ValueError
:
import dask as dd
data1 = dd.read_sql_table('TABLE', connection_string, index_col = ['DATE','ITEM'],schema= 'CRE') gives me a value error --> ValueError: Use label when passing an SQLAlchemy instance as the index
当我只使用如下所示的日期时,我可以将数据提取到dask dataframe
。
data1 = dd.read_sql_table('TABLE', connection_string, index_col ='DATE',schema= 'CRE')
我的猜测是 dd.read_sql_table 需要一个索引列来拆分数据。 理想情况下,该列在您的 SQL 数据库中建立索引,以便于分区/分片。
将数据读入 Dask dataframe 后,您可以对其进行其他操作。 但是,请注意,截至 2020-06-27 Dask dataframe 不支持多索引。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.