Userlightgbm.basic.LightGBMError: Do not support special JSON characters in feature name

错误消息lightgbm.basic。LightGBMError:在功能名称中不支持特殊的JSON字符表示数据集的功能名称包含LightGBM在将数据转换为JSON格式时不支持的字符。JSON格式不支持像{,},:,&,%,#,@,$,``,“”,“,”,',[,]和/这样的字符。

若要解决此错误,应清除数据集中的功能名称,以删除或替换这些特殊字符。

可以用rename函数更改功能名称:

data.rename(columns={'Age': 'Age',
                         'Sex': 'Sex',
                         'BMI (kg/m2)': 'BMI',
                         'Smoking [n (%)]': 'Smoking',
                         'Alcohol [n (%)]': 'Alcohol',
                         'Diabetes mellitus [n (%)]': 'Diabetes-mellitus',
                         '高血压': 'Hypertension',
                         '冠心病': 'Coronary-heart-disease',
                         '脑血管病': 'Cerebrovascular-disease',
                         'Splenectomy': 'Splenectomy',
                         '上消化道出血史': 'History-of-upper-GI-bleeding',
                         'Endoscopic ligation [n (%)]': 'Endoscopic-ligation',
                         'Endoscopic sclerotherapy [n (%)]': 'Endoscopic-sclerotherapy',
                         'HBV': 'HBV-bool',
                         'HCV': 'HCV-bool',
                         'Alcohol': 'Alcohol-bool',
                         'Autoimmune': 'Autoimmune-bool',
                         'Other': 'Other-bool',
                         'Child-Pugh level': 'Child-Pugh-level',
                         '腹水量': 'Abdominal-water',
                         '白蛋白量': 'Albumin',
                         '肝性脑病': 'Hepatic-encephalopathy',
                         'PT时间': 'PT-Time',
                         '胆红素评分': 'Bilirubin-score',
                         'MELD score': 'MELD-score',
                         'ALT (U/L)': 'ALT',
                         'AST (U/L)': 'AST',
                         'TBIL (umol/L)': 'TBIL',
                         'TP (g/L)': 'TP',
                         'ALB (g/L)': 'ALB',
                         'BUN (umol/L)': 'BUN',
                         'sCr (umol/L)': 'sCr',
                         'TT (s)': 'TT',
                         'PT (s)': 'PT',
                         'PTA (%)': 'PTA',
                         'INR': 'INR',
                         'APTT (s)': 'APTT',
                         'FIB (g/L)': 'FIB',
                         'D-dimer (ug/L)': 'D-dimer',
                         'CRP(mg/L)': 'CRP',
                         'WBC (×109/L)': 'WBC',
                         'Hb (g/L)': 'Hb',
                         'PLT (×109/L)': 'PLT',
                         '中性粒细胞绝对值': 'Neutrophil-absolute',
                         '淋巴细胞绝对值': 'lymphocytes-absolute',
                         '单核细胞绝对值': 'Monocytes-absolute',
                         'neutrophil-to-lymphocyte ratio (NLR)': 'NLR',
                         'monocyte-to-lymphocyte ratio (MLR)': 'MLR',
                         'platelet-to-lymphocyte ratio (PLR)': 'PLR',
                         # '肝硬化时长': 'Duration-of-cirrhosi
                         # '消化道出血时长': 'Duration-of-GI-bleeding',
                         '肝硬化时年龄': 'Age-of-cirrhosis',
                         '消化道出血时年龄': 'Age-of-GI-bleeding',
                         'GLO (g/L)':'GLO',
                         '是否失代偿':'decompensation-bool',
                         '门脉海绵样变':'CTPV',
                         '身高':'height',
                         '体重':'weight'

                         }, inplace=True)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值