上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要: 被装饰的函数,总是被替换成@符号所引用的函数的返回值。这是本质 因此,被装饰的函数会变成什么,完全取决于@符号所引用的函数的返回值 如果@符号所引用的函数,返回值是字符串,那被装饰的函数就被替换成了字符串 如果@符号所引用的函数,返回值是函数,那被修饰的函数在替换之后还是函数 1. def funA 阅读全文
posted @ 2021-12-12 11:31 朵朵奇fa 阅读(32) 评论(0) 推荐(0) 编辑
摘要: class Bird: #类方法 @classmethod def fly(cls): print("类方法fly:",cls) #静态方法 @staticmethod def info(p): print("静态方法 info:",p) #类方法会自动绑定第一个参数,一般是类的名字 Bird.fl 阅读全文
posted @ 2021-12-12 11:04 朵朵奇fa 阅读(37) 评论(0) 推荐(0) 编辑
摘要: class A: def __init__(self,name,age): self.name = "shun" self.age = 18 def eat(self): print (" i want to eat") A.eat() 报错, self 表示实例, A.eat()没有传入实例 cl 阅读全文
posted @ 2021-12-12 10:49 朵朵奇fa 阅读(444) 评论(0) 推荐(0) 编辑
摘要: class Ctc(object): def __init__(self): self.name = "shun" def run(self): self.prea() self.a() self.b() self.c() def a(self): print("a") def b(self): p 阅读全文
posted @ 2021-09-12 21:47 朵朵奇fa 阅读(65) 评论(0) 推荐(0) 编辑
摘要: def CheckValue(value): value = int(value) #assert condiction, expression #当 condition为True的时候,程序不会assert,当condition判断的条件为False时候,程序就会assert assert val 阅读全文
posted @ 2021-09-12 17:40 朵朵奇fa 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 为什么要用 super() 当子类重写了父类方法时,又想调用父类的同名方法时,就需要用到 super() 关于super函数的详细解释 Python - 面向对象编程 - super() - 小菠萝测试笔记 - 博客园 (cnblogs.com) class FooGrandParent(objec 阅读全文
posted @ 2021-09-12 17:04 朵朵奇fa 阅读(753) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import datacompy #导入datafcompy库 比较两个dataframe之间的区别 #同时也可以比较两个txt之间的区别 df1 = pd.read_csv("1.txt",header=None) df2 = pd.read_csv("22 阅读全文
posted @ 2021-03-22 22:08 朵朵奇fa 阅读(1620) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import matplotlib.pyplot as plt dataflair = pd.read_csv("https://download.mlcc.google.com/mledu-datasets/california_housing_train. 阅读全文
posted @ 2021-03-21 18:25 朵朵奇fa 阅读(62) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import numpy as np df1= pd.DataFrame({'第一列':[111,222,333,444,555,666],'第二列':[11,22,33,44,55,66],'第三列':['shu1','shun2','shun3','shu 阅读全文
posted @ 2021-03-21 18:15 朵朵奇fa 阅读(152) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd def adder(el1,el2): return el1+el2 def delte(args): return args+"+delte" s1 = pd.Series([1,2,3]) s1 = s1.pipe(adder,3) print(s1) s 阅读全文
posted @ 2021-03-21 16:42 朵朵奇fa 阅读(70) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页