首页 > 解决方案 > Data_load_utility 问题 TypeError:+ 不支持的操作数类型:“NoneType”和“str”

问题描述

我正在使用数据加载实用程序并出现错误。

此方法是我在 github 中加载数据的一个实用程序的一部分。我将它用于不同的场景。此实用程序中的几乎所有功能都会导致相同的问题。将 Python 3.x 与 Juypter 笔记本一起使用。

https://github.com/SAP-samples/hana-ml-samples/blob/master/Python-API/pal/notebooks/data_load_utils.py

代码:

@staticmethod
    def load_shampoo_data(connection, schema=None, batch_size=10000, force=False,train_percentage=1.0,valid_percentage=0.0,test_percentage=0.0):
        if schema is None:
            schema = Settings.user
        full_tbl = "SHAMPOO_SALES_DATA_TBL"
        tables = [full_tbl]
        fq_tables = [schema + '.' + tbl for tbl in tables]
        cols = '( \
                ID INTEGER NULL,\
                SALES DOUBLE NULL\
                )'
        inlist = '("ID", "SALES") \
                    VALUES (?, ?)'
        DataSets.load_data_auto(connection, fq_tables, cols, inlist,'../datasets/shampoo.csv',train_percentage,valid_percentage,test_percentage, batch_size,force)
        if len(tables) == 1:
            return tables[0]
        return tuple(tables)

我得到的错误:

----> 1 data_tbl = DataSets.load_shampoo_data(connection_context) 中的 TypeError Traceback (最近一次调用最后一次)

C:\dir python util\data_load_utils.py in load_shampoo_data(connection, schema, batch_size, force, train_percentage, valid_percentage, test_percentage) 630 full_tbl = "SHAMPOO_SALES_DATA_TBL" 631 个表 = [full_tbl] --> 632 fq_tables = [schema + '。 ' + tbl for tbl in tables] 633 cols = '(
634 ID INTEGER NULL,\

C:\dir python util\data_load_utils.py in (.0) 630 full_tbl = "SHAMPOO_SALES_DATA_TBL" 631 个表 = [full_tbl] --> 632 fq_tables = [schema + '.' + tbl for tbl in tables] 633 cols = '(
634 ID INTEGER NULL,\

类型错误:+ 不支持的操作数类型:“NoneType”和“str”

标签: python-3.xjupyter-notebook

解决方案


推荐阅读