属性错误:“ NoneType”对象没有属性“ split”

时间:2018-10-12 03:59:08

标签: python-3.x object split range attributeerror

执行以下代码时遇到错误:

list_secName = []
list_table = []

df1 = json_normalize(data = menu["payload"], record_path = ["menusByKey"])

for i in range(116):
    len_section = len(menu["payload"]['menusByKey'][i]['menu']["menuSections"])

    for j in range(len_section):
        sectionName = [x for x in menu["payload"]['menusByKey'][i]['menu']["menuSections"][j]["sectionName"].split(',')]
        sectionName[0]
        list_secName.append(sectionName[0])
    dfbase = pd.DataFrame({'col':list_secName})
    dfbase['menuKey'] = key
    list_table.append(dfbase)

final_section = pd.DataFrame(pd.concat(list_table))

错误如下:

  

属性错误:“ NoneType”对象没有属性“ split”

0 个答案:

没有答案