报错处理
报错处理record
捣蛋怪大眼萌
好好学习|积极乐观
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【error solved】‘utf-8‘ codec can‘t decode bytes in position XX-XX: invalid continuation byte
报错内容: ‘utf-8’ codec can’t decode bytes in position XX: invalid continuation byte 报错原因:解析器遇到了无法解码(decode)的字符 解决方法:可以尝试不同的转换器 或者 直接将无法解析的字符ignore df = pd.read_csv('../data/filename.csv', encoding_errors = 'ignore') ...转载 2022-04-29 14:25:57 · 5722 阅读 · 0 评论 -
【error solved】Error tokenizing data. C error: Expected 1 fields in line XX, saw XX
报错内容:Error tokenizing data. C error: Expected 1 fields in line XX, saw XX 报错原因:CSV的分隔符设置异常 / 存储的时候格式有问题 解决方法: 方法一 通过csv库进行读取,再遍历,再进行合并保存 (文件不大的情况下可用),太大转置的时候RAM会hang import pandas as pd import csv path = 'file_absolute_path/filename.csv' test = pd.DataFra转载 2022-04-27 12:10:20 · 5861 阅读 · 1 评论 -
【error solved】AttributeError: module ‘time‘ has no attribute ‘clock‘
报错源码: import time # active the time clock start = time.clock() # here is the code need to test running time # calculate the time between start and end end = time.clock() print('运行时间 : %s 秒' %(end-start)) 报错内容:AttributeError module ‘time’ has no attribut转载 2022-04-27 11:41:34 · 353 阅读 · 0 评论 -
【error solved】Pandas DataFrame.to_csv raising IOError: No such file or directory
报错的意思是, 没有对应的文件夹。 可能是在上一步操作的时候把路径指定了? os.chdir(path) 用了网上的方法,先判断是否文件夹存在,如果不存在,就先创建对应的文件夹。 import os outname = 'filename.csv' outdir = './dir' if not os.path.exists(outdir): os.mkdir(outdir) fullname = os.path.join(outdir, outname) df.to_csv(fullname) 还是原创 2022-04-27 09:46:00 · 675 阅读 · 0 评论
分享