python
NorthFish北海有鱼
simple notebook.想去硅谷写代码
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python三维矩阵的维度
这种三维数据结构通常在 Python 中使用 numpy 数组表示,访问方式为 array[z, y, x](2)旋转坐标系测试:例如,用相同的参数在XZ平面测试,结果应与XY平面相同。(1)设置Z轴速度为0,验证xy平面上的结果。第一个维度(最外层的括号)对应 z 方向,第二个维度(中间层的括号)对应 y 方向,第三个维度(最内层的括号)对应 x 方向。例如这样的三维矩阵,原创 2025-04-23 18:05:44 · 330 阅读 · 0 评论 -
python数值误差
x要先和num_grids_per_axis相乘,然后再除以physical_length。先除再乘的话,数学逻辑上一样,但是如果一个很小的数,除以一个很大的数,会有舍入误差。最近在用fenics框架跑有限元代码,其中有一个部分是把在矩阵里定义的初始值,赋值到有限元空间里,这就涉及到了初始矩阵和有限元空间坐标的转化,部分代码如下。原创 2024-09-07 01:17:12 · 450 阅读 · 1 评论 -
python相关
1.多线程https://my.oschina.net/liuyuantao/blog/1154504https://jingsam.github.io/2015/12/31/multiprocessing.html可以认为for是在提交任务,然后并行算,每个核心去跑对应的任务最后合并结果2.python多线程和c语音有什么不一样3.判别器和生成器......原创 2020-04-25 00:21:00 · 207 阅读 · 0 评论 -
python列表sort
列表里的元组sort按照元组的第一个元素来排列。class Solution: def cutOffTree(self, forest): M = len(forest) N = len(forest[0]) trees = [] for i in range(M): for j in range(N): if (forest[i][j] > 1):原创 2022-05-24 17:28:35 · 168 阅读 · 0 评论 -
python处理json/xml文件
import jsonimport randomimport collectionsfilename = '在线请求0426.txt'# 将数据加载到一个列表中#首先得到所有的商家,把商家设置一个状态,存到一个map里poiid_status_maps={}poiid_shelf_maps= collections.defaultdict(list)shelf_poiid_maps= collections.defaultdict(list)with open(filename) as .原创 2022-04-26 17:57:18 · 1077 阅读 · 0 评论 -
哈希表/列表的时间复杂度
Python 各种集合内置方法的时间复杂度_Baoli1008的博客-优快云博客_python set 时间复杂度python list 之时间复杂度分析 - 简书原创 2022-04-13 15:13:46 · 2042 阅读 · 0 评论 -
python画图工具
import matplotlib.pyplot as pltimport seaborn as snsfrom matplotlib import ticker%matplotlib inlineplt.rcParams['font.sans-serif'] = ['SimHei'] # 中文字体设置-黑体plt.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题sns.set(font='SimHei',font_.原创 2022-03-22 17:34:41 · 1185 阅读 · 0 评论 -
python设计模式
Python设计模式——装饰模式(Decorator) - Xjng - 博客园假如我们需要开发一个程序来展示一个人穿衣服的过程。#encoding=utf-8__author__ = 'kevinlu1010@qq.com'class Person(): defhttps://www.cnblogs.com/Xjng/p/3877471.html原创 2021-11-04 20:35:20 · 300 阅读 · 0 评论 -
python一些用法
迭代器,生成器,装饰器原创 2021-04-20 16:43:21 · 150 阅读 · 0 评论
分享