01 2020 档案
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12246482.html ·reshape() In many cases, you can convert an array from one shape to another without copy
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12246045.html Boolean Indexing The boolean array must be of the same length as the array axis it’s inde
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12245002.html Basic Indexing and Slicing One-dimensional arrays are simple; on the surface they act sim
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12244981.html vectorization Arrays are important because they enable you to express batch operations on
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12244852.html dtype The data type or dtype is a special object containing the information (or metadata,
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12244066.html ndarray - A Multidimensional Array Object One of the key features of NumPy is its N-dimen
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12243889.html Introduction NumPy is the fundamental package for scientific computing with Python. It co
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12233622.html dis 可以使用dis模块来判断哪种代码的运行速度更快,具体的原理是:Python代码是由Python虚拟机执行的,Python虚拟机执行的是字节码,Python代码运行前会被编
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12233607.html with with语句从Python 2.5开始引入,实现了上下文管理协议,实现了__enter__() 和 __exit__() 方法。 没有使用上下文管理器之前的代码: fi
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12232581.html 高阶函数 所谓高阶函数,就是传入的参数是函数,返回值也是函数的函数。最常见的高阶函数有map、reduce、filter、sorted,当然也可以自定义高阶函数。 以map为例,
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12232565.html lambda 在传入函数时,有些时候不需要显式地定义函数,直接传入匿名函数更方便。在Python中关键字lambda表示匿名函数,匿名函数有个限制,就是只能有一个表达式,不用写r
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12232548.html collections模块提供了一些可以替换Python标准内建容器如dict、list、set和tuple等的选择。 Counter类型 它是dict的子类,提供了可哈希对象的
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12229194.html 字符串连接 使用加号 'Python' + '.' + 'NumPy' + '.' + 'Pandas' + '.' + 'Matplotlib' 使用%s进行字符串替换 '%s
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12228953.html 给函数添加一些相应的功能,但是又不想影响函数的主业务功能,可以通过装饰器来实现。 e.g. 统计函数的执行时间 装饰函数 import time def timer(func):
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12228750.html 把列表推导式的方括号 [] 改成 圆括号 () ,就完成了一个生成器。 列表推导式 生成器 yield 在Python中,一个函数使用了 yield 方法,这个函数就是一个生成器
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12222625.html 推导式是构建列表、字典、结合和生成器的快捷方式。 e.g. 1 mylist = [] 2 3 for i in range(1, 11): 4 if i < 5: 5 myli
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12200025.html Matplotlib Anatomy Reference https://matplotlib.org/gallery/showcase/anatomy.html
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12199828.html json.dumps # dict => json str data_dict = { 'username' : 'hello', 'password' : 'world' }
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12198115.html 空列表,空字典,空元组 空字符创,空白字符串,False,True,None 0, 非0 Summary None,False,0,空列表[],空字典{},空元祖(),空字符串(
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12171406.html *args 星号 * 的参数 *args 会以元组的形式导入 1 def func(*args): 2 for arg in args: 3 print(arg) 4 5 6 f
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12170958.html List 遍历 1 l = [1, 2, 3, 4, 5, 6] 2 3 for i in l: 4 print(i) 5 6 for i in range(len(l)): 7
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12170632.html Python Data Type 列表和元组的区别 列表和元组都是有序的,可以存储任意数据类型的集合。 区别主要在于下面这两点 列表是动态的,长度可变,可以随意的增加、删减或改变
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12167897.html Project Directory Note: 所有 __init__.py 都是空的 Config env_config.py 1 class Config(object):
阅读全文
摘要:原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12145936.html PIP Dependency pip install flask pip install flask-sqlalchemy pip install pymysql pip ins
阅读全文