Docker 命令大全docker run --help
Renko's blog
人生如逆旅,我亦是行人
-
-
numpy&pandas
官方教材:
中文版:
http://pandas.apachecn.org/大部分整理复制自用Python进行数据分析
1. 导入包
1
2
3
4#导入numpy包
import numpy as np
#导入pandas包
import pandas as pd2. 一维数据分析
more...1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17a=np.array([2,3,4,5])
#查询元素
a[0]
#2
#切片访问
a[1:3]
#array([3, 4])
#循环访问
for i in a:
print(i)
#2
#3
#4
#5
#数据类型
a.dtype
#dtype('int64') -
python语法基础
python下载
python文档
python异常
python规范0. 命名规范
Type Public Internal Modules模块 lower_with_under _lower_with_under Packages包 lower_with_under Classes类 CapWords _CapWords Exceptions异常 CapWords Functions函数 lower_with_under() _lower_with_under() Global/Class Constants全局/类常量 CAPS_WITH_UNDER _CAPS_WITH_UNDER Global/Class Variables全局/类变量 lower_with_under _lower_with_under Instance Variables实例变量 lower_with_under _lower_with_under (protected) or __lower_with_under (private) Method Names方法 lower_with_under() _lower_with_under() (protected) or __lower_with_under() (private) Function/Method Parameters参数 lower_with_under Local Variables本地变量 lower_with_under 1. 直接运行py文件
在
.py
文件的第一行加上:1
#!/usr/bin/env python
再执行
1
$ chmod a+x hello.py
然后就可以直接运行
more..../hello.py
-
Cython&Wheel
可以直接看第七项
1. Cython入门
完全摘抄自Cython 三分钟入门
python
more...1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28import math
def great_circle(lon1,lat1,lon2,lat2):
radius = 3956 #miles
x = math.pi/180.0
a = (90.0-lat1)*(x)
b = (90.0-lat2)*(x)
theta = (lon2-lon1)*(x)
c = math.acos((math.cos(a)*math.cos(b)) +
(math.sin(a)*math.sin(b)*math.cos(theta)))
return radius*c
###########
# 调用它 50 万次并测定它的时间
###########
import timeit
lon1, lat1, lon2, lat2 = -72.345, 34.323, -61.823, 54.826
num = 500000
t = timeit.Timer("p1.great_circle(%f,%f,%f,%f)" % (lon1,lat1,lon2,lat2),
"import p1")
print "Pure python function", t.timeit(num), "sec"
#####
#约2.2秒
##### -
python 打包冻结(PyInstaller)
PyInstaller
Install PyInstaller from PyPI:
1
pip install pyinstaller
Go to your program’s directory and run:
1
pyinstaller yourprogram.py
This will generate the bundle in a subdirectory called dist.
more... -
excel 替换宏 列运算
more...1
2
3
4
5
6
7
8
9
10
11
12
13
14
15Sub tihuan()
Dim rCell As Range
For Each rCell In Selection
If rCell.Value = "差旅费" Then rCell.Value = "Fee_0"
If rCell.Value = "业务招待费" Then rCell.Value = "Fee_1"
If rCell.Value = "公务车费用" Then rCell.Value = "Fee_2"
If rCell.Value = "办公费" Then rCell.Value = "Fee_3"
If rCell.Value = "因公临时出国(境)" Then rCell.Value = "Fee_4"
If rCell.Value = "培训费" Then rCell.Value = "Fee_5"
If rCell.Value = "工会经费" Then rCell.Value = "Fee_6"
If rCell.Value = "通讯费" Then rCell.Value = "Fee_7"
If rCell.Value = "会议费" Then rCell.Value = "Fee_8"
If rCell.Value = "团队建设费" Then rCell.Value = "Fee_9"
Next
End Sub