我声明了一个空列表_Xs_pred,然后尝试将单个列数据帧复制到列表中。该命令运行无误,但无法打印列表中的项目。 textual_data是单列数据框,其文本值是用空格连接的单词。我收到一个错误的“无法散列的列表”
a = {'all_terms': ['Bus Sys Analyst Sr IT Information Technology IT-Merchandising It Information Technology',
'Retail Sales Specialist Retail Retail-Camping Retail Stores',
'Operations Specialist Retail Retail-Stocking Retail Stores',
'Sales Lead Retail Retail-Sales Lead Retail Stores',
'Retail Sales Specialist Retail Retail-Cashier Retail Stores']}
textual_data = pd.DataFrame(data=a)
_Xs_pred = [None, None]
report=True
model_levels = [True, True, True]
idx_col = ['Data Order']
_levels = ['Level-1', 'Level-2', 'Level-3']
for i in range(2):
if model_levels[i]:
textual_data.index.name = idx_col
_Xs_pred[i] = textual_data.copy()
if report:
print("ETL complete on {} data."
.format(_levels[i]))
else:
continue
print(_Xs_pred)
我希望输出为_Xs_pred,其中两列具有相同的textual_data。目前我看不到_Xs_pred