from openpyxl import load_workbook from matplotlib import pyplot as plt class NotNumError(ValueError): def __init__(self, year, province, industry, type): #不要忘记self self.year = year self.province = province self.industry = industry self.type = type self.message = '{}年{}地区{}产业排放的{}类型二氧化碳为空值'.format(self.year, self.province, self.industry, self.type) class GetValue(): def __init__(self,y,p,i,t,name,row,col): self.year = y self.province = p self.industry = i self.type = t self.row=row self.col=col self.v = name.cell(self.row, self.col).value def is_error(self): if self.v == None: raise NotNumError(self.year, self.province, self.industry, self.type) #这里只是指出有错误,以后还要举出错误 class DataAnalyse(): def __init__(self,
python使用类分析excel (每个文件包括多个sheet),并排查是否有空值和零值
最新推荐文章于 2023-05-30 14:44:00 发布