为了账号安全,请及时绑定邮箱和手机立即绑定

Pandas 数据帧去除非数字字符

Pandas 数据帧去除非数字字符

噜噜哒 2021-09-11 15:30:33
我正在处理以下形式的数据:Accuracy 26.15%, error rate 0.00%, not classified 73.85%Accuracy 29.68%, error rate 0.00%, not classified 70.32%Accuracy 33.98%, error rate 0.00%, not classified 66.02%Accuracy 35.34%, error rate 0.00%, not classified 64.66%Accuracy 35.75%, error rate 0.00%, not classified 64.25%Accuracy 37.51%, error rate 0.00%, not classified 62.49%Accuracy 38.63%, error rate 0.00%, not classified 61.37%Accuracy 40.81%, error rate 0.00%, not classified 59.19%Accuracy 41.22%, error rate 0.00%, not classified 58.78%Accuracy 41.99%, error rate 0.00%, not classified 58.01%Accuracy 42.34%, error rate 0.00%, not classified 57.66%Accuracy 42.40%, error rate 0.00%, not classified 57.60%Accuracy 43.05%, error rate 0.00%, not classified 56.95%Accuracy 44.29%, error rate 0.00%, not classified 55.71%Accuracy 44.35%, error rate 0.00%, not classified 55.65%Accuracy 44.76%, error rate 0.00%, not classified 55.24%Accuracy 45.29%, error rate 0.00%, not classified 54.71%Accuracy 45.35%, error rate 0.00%, not classified 54.65%Accuracy 95.35%, error rate 4.24%, not classified 0.41%Accuracy 95.76%, error rate 4.24%, not classified 0.00%Stats on test dataAccuracy 94.74%, error rate 5.26%, not classified 0.00%如何将其加载到 Pandas 数据框中,标题为“准确性”、“错误率”和“未分类”,同时还从数据字段中删除非数字字符。到目前为止,我有:pd.read_csv("test.csv", names=['Accuracy', 'Error rate', 'Not classified'])但这会产生:    Accuracy    Error rate  Not classified0   Accuracy 25.85% error rate 0.00%    not classified 74.15%1   Accuracy 29.92% error rate 0.00%    not classified 70.08%2   Accuracy 33.69% error rate 0.00%    not classified 66.31%3   Accuracy 36.16% error rate 0.00%    not classified 63.84%4   Accuracy 37.16% error rate 0.00%    not classified 62.84%5   Accuracy 39.28% error rate 0.00%    not classified 60.72%6   Accuracy 39.58% error rate 0.00%    not classified 60.42%7   Accuracy 40.05% error rate 0.00%    not classified 59.95%
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 263 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信