1.优化上传空白表后,后端代码会报错

This commit is contained in:
李伟 2022-02-22 14:17:08 +08:00
parent 7e1e030839
commit d40163f686

View File

@ -100,6 +100,8 @@ async def add_select_map(
"""添加属性值选择映射"""
dfs = pd.read_excel(file, engine='openpyxl', sheet_name=None)
for attr_name, df in dfs.items():
#将id这列转换成字符串类型
if len(df) >0:
df['id'] = df['id'].astype(str)
map_ = df.to_dict('records')
data_in = schemas.SelectMap(game=game, attr_name=attr_name, map_=map_)