python学习笔记
ForrestLin0805
这个作者很懒,什么都没留下…
展开
-
multiindex slice
#指定三个索引df.loc[(slice(None), slice(None), slice(None), :]#不加逗号和:,表示一个行索引,一个列索引df.loc[(slice(index), slice(columns))]原创 2019-11-25 14:54:00 · 324 阅读 · 0 评论 -
python 类获取属性内容
使用vars(self).items() 获取class的属性名称及值class test(): self.a = 1 self.b = 2 def to_dict(self): result = {} for name, value in vars(self).items(): result[name] = value原创 2019-11-19 10:44:17 · 465 阅读 · 0 评论 -
pandas 行列操作笔记
data = DataFrame(np.arange(16).reshape(4,4),index=list('abcd'),columns=list('wxyz'))data['w'] #选择表格中的'w'列,使用类字典属性,返回的是Series类型data.w #选择表格中的'w'列,使用点属性,返回的是Series类型data[['w']] #选择表格中的'w'列,返回...转载 2019-10-16 13:24:29 · 193 阅读 · 0 评论 -
exception 种类
ExceptionDescriptionAssertionErrorRaised when the assert statement fails.AttributeErrorRaised on the attribute assignment or reference fails.EOFErrorRaised when the input() function...原创 2019-10-16 09:36:17 · 218 阅读 · 0 评论 -
python包创建
python包创建和发布1.创建一个文件夹文件夹中需包含__init__.py 文件,该文件夹即为一个包,文件夹名称为包的名称。2.编写__init__.py 文件ps:__init__.py文件可以为空。如果目录中包含了 __init__.py 时,当用 import 导入该目录时,会执行 __init__.py 里面的代码。为方便调用包,最好在 __init__.py 文件中直接编...原创 2019-10-11 23:01:18 · 595 阅读 · 0 评论 -
ast参考资料
#AST资料https://docs.python.org/3/library/ast.htmlhttps://blog.csdn.net/ma89481508/article/details/56017697https://greentreesnakes.readthedocs.io/en/latest/examples.htmlhttp://www.dalkescientific.co...原创 2019-09-25 10:49:12 · 280 阅读 · 0 评论 -
numpy 加速
参考资料https://morvanzhou.github.io/tutorials/data-manipulation/np-pd/4-1-speed-up-numpy/原创 2019-09-26 14:26:14 · 369 阅读 · 1 评论 -
as_strided用法解释
https://zhuanlan.zhihu.com/p/64933417转载 2019-10-08 16:07:30 · 3272 阅读 · 0 评论