python 科学计算
景晨博
day1 p.m.
数值计算
gis处理
numpy
scipy
matplotlib
fiona
shapely
geopandas
|
数值计算
1、numpy:
高性能的多维数组的计算库
2、scipy:
构建在numpy的基础之上的,科学 计算库
3、matplotlib:
绘图工具
1
Numpy:高性能的多维数组的计算库
— 快速的开发效率
— 快速的运行效率
1
Numpy:高性能的多维数组的计算库
使用numpy提高代码效率的四个策略
1、使用numpy的ufuncs
2、使用numpy的aggregations
3、使用numpy的broadcasting
4、使用numpy的masking、indexing
1
Numpy:高性能的多维数组的计算库

正常的Python操作:
使用numpy的ufuncs:

ufuncs: 是universal function的缩写,
它是一种能对数组中每个元素进行操作的函数
1
Numpy:高性能的多维数组的计算库
-算数运算:+ - * / %
-按位运算:&|~ ^ >> <<
-比较运算:< > <= >= == !=
-三角函数:np.sin np.cos np.tan
.......还有很多
1
Numpy:高性能的多维数组的计算库
NumPy’s aggregations : 计算描述数组的值的函数
(min, max, sum, mean ...)
正常的Python操作:

使用numpy的aggregations:

1
Numpy:高性能的多维数组的计算库
NumPy’s broadcasting :
broadcasting 是 当 使用ufuncs 来计算不同大小或者维度的数组时,制定的计算规则

1
Numpy:高性能的多维数组的计算库
1
Numpy:高性能的多维数组的计算库
NumPy’s masking, and fancy indexing
1
Numpy:高性能的多维数组的计算库

2
scipy:科学计算库
SciPy是构建在numpy的基础之上的,它提供了许多的操作numpy的数组的函数。SciPy是一款方便、易于使用、专为科学和工程设计的python工具包,它包括了统计、优化、整合以及线性代数模块、傅里叶变换、信号和图像图例,常微分方差的求解等
numpy
scipy
2
scipy:科学计算库
图像示例:



download.jpg
result.jpg
3
Matplotlib:绘图工具




2
gis处理
1、fiona:读写文件
2、shapely:空间操作
3、geopandas:地理数据框架
Fiona And Shapely:
—使用Python处理空间数据的基础工具库
—相对于ESRI’s Python toolchain
稳定、免费
1
fiona:读写文件
2
shapely:空间操作
shapely库主要的功能是对地理数据进行空间操作
—buffer
—union
—intersect
....
3
geopandas:数据框架
在Python下更容易处理地理数据 !
3
geopandas:数据框架
geopandas
pandas
shapely
fiona
matplotlib
3
geopandas:数据框架
—GeoSeries
几何图形的序列
—GeoDataFrame
列表数据结构
3
geopandas:数据框架
——GeoSeries
实现了几乎所有的Shapely对象的属性和方法
GeoSeries.area、GeoSeries.bounds、
GeoSeries.contains(other)、
GeoSeries.intersects(other)
3
geopandas:数据框架
——GeoDataframe
GeoDataFrame是一个列表数据结构,它包含一个叫做包含geometry的列,这个geometry包含一个GeoSeries
GeoDataFrame.from_postgis
GeoDataFrame.from_file
python科学计算 P.M.
By cb jing
python科学计算 P.M.
- 585