loc[:,'销售时间'] #对字符串进行分割,获取销售日期 dateSer=splitSaletime(timeSer) ''' 注意: 如果运行后报错:AttributeError: 'float' object has no attribute 'split' 是因为Excel中的空的cell读入pandas中是空值(NaN),这个NaN是个浮点类型,一般当作空值处理。 所以要先去除NaN在进行分隔字符串 ''' N...
整数(int):就是我们平常所说的整数,没有小数部分,比如10、-5 ,在 Python 中,整数的范围非常大,几乎可以处理任何大小的整数,你可以尽情进行大数运算 。 浮点数(float):用于表示有小数部分的数字,像3.14、9.81 ,通常以科学计数法或十进制表示。在进行浮点数运算时,要注意精度问题,因为计算机对浮点数的存储和运算...
file object is passed, `mode` might need to contain a `'b'`. .. versionchanged:: 1.2.0 Support for binary file objects was introduced. sep : str, default ',' String of length 1. Field delimiter for the output file. na_rep : str, default '' Missing data representation. float_forma...
has_delete_permission(self, *args, **kwargs): # 禁止删除 if args: return True return False def has_add_permission(self,*args,**kwargs): # 禁止增加 return False def save_models(self): # 用户级别设置 self.new_obj.user = self.request.user flag = self.org_obj is None and 'create'...
所以很多小伙伴在使用Pyecharts出现了类似'pyecharts' has no attribute 'xxx'的报错,那是因为你安装...
__foo() # 报错 AttributeError: 'Site' object has no attribute '__foo' 类的一些专有方法 __init__ : 构造函数,在生成对象时调用 __del__ : 析构函数,释放对象时使用 __repr__ : 打印,转换 __setitem__ : 按照索引赋值 __getitem__: 按照索引获取值 __len__: 获得长度 __cmp__: 比较...
In [58]: data2.isnull()Out[58]:a Trueb Falsec Falsed Falsedtype: boolIn [59]: data2.notnull()Out[59]:a Falseb Truec Trued Truedtype: boolIn [60]: data2[data2.isnull()==True] #嵌套查询NaNOut[60]:a NaNdtype: float64In [64]: data2.count() #统计非NaN个数Out[64]:...
object 10 sex 32561 non-null object 11 capital-gain 32561 non-null int64 12 capital-loss 32561 non-null int64 13 hours-per-week 32561 non-null int64 14 native-country 32561 non-null object 15 salary 32561 non-null object dtypes: float64(1), int64(6), object(9) memory usage: 4.0+ ...
AttributeError 试图访问一个对象没有的属性,比如foo.x,但是foo没有属性x IOError 输入/输出异常;基本上是无法打开文件 ImportError 无法引入模块或包;基本上是路径问题或名称错误 IndentationError 语法错误(的子类) ;代码没有正确对齐 IndexError 下标索引超出序列边界,比如当x只有三个元素,却试图访问x[5] ...
B010 SetAttrWithConstant Do not call setattr with a constant attribute value. It is not any safer than normal property access. 🛠 B011 DoNotAssertFalse Do not assert False (python -O removes these calls), raise AssertionError() 🛠 B012 JumpStatementInFinally return/continue/break inside fina...