python
AWS加油站
️亚马逊云科技技术支持
亚马逊云科技技领博主
10X Cloud Certification
5X Amazon Certification
展开
-
python 中zip() 不同版本之间的差异, *表达式
1. zip()之前练习的时候写过这样的代码:items = ["bananas", "mattress", "dog kennels", "machine", "cheeses"]weights = [15, 34, 42, 120, 5]totals = zip(items, weights)for total in totals: print(total, end=' ...原创 2018-04-17 07:45:43 · 637 阅读 · 0 评论 -
pytorch清华环境
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config --set show_channe...原创 2019-09-12 14:54:28 · 225 阅读 · 0 评论 -
python环境迁移
由于某些原因我们要做python环境的迁移,下边看一下环境的导入和导出导出环境pip freeze > requirements.txt导入环境pip install -r requirements.txt原创 2019-06-28 19:26:11 · 3782 阅读 · 0 评论 -
python的佛性
简单介绍一点python的佛性。python开始支持了连不等式,不用再拆开了。weight = 30if 18.5 < weight < 25: print("BMI is considered 'normal'")if weight > 18.5 and weight < 25: print("norma原创 2018-05-02 21:33:00 · 155 阅读 · 0 评论 -
python胶水语言特性,连接java和c++
python是有名的胶水语言,今天打算试下它的from jpype import *startJVM(getDefaultJVMPath(), "-ea")a = java.lang.System.out.println("Hello World")shutdownJVM()import ctypesso = ctypes.cdll.LoadLi原创 2019-02-21 12:19:09 · 1787 阅读 · 0 评论 -
pandas 数据分析实战 (1)数据分析过程
数据分析要使用的库数据分析过程 我们将数据分析过程组织为五个步骤:提问、整理、探索、得出结论和传达结果。以下是关键要点的概述,但你可以选择跳过。我们将在后面的部分中演练每一步,所以你将很快熟悉整个过程。第 1 步:提问 你要么获取一批数据,然后根据它提问,要么先提问,然后根据问题收集数据。在这两种情况下,好的问题可以帮助你将精力集中在数据的相关部分,并帮助你得出有洞察力的分析。...转载 2018-06-09 21:18:09 · 1037 阅读 · 0 评论 -
ipython notebook 使用 matplotlib画图
matplotlib 绘制折线图from matplotlib import pyplot as plt%pylab inline#jupyter 要加这句x = [1,2,3,4,5]y = [num**2 for num in x]plt.plot(x, y, color='green', marker='o', linestyle='solid')plt.title('x*...原创 2018-05-16 16:36:31 · 12109 阅读 · 0 评论 -
python 高阶函数
python 内置高阶函数 映射函数 MAP() 过滤函数 filter() 规约函数 reduce()python 高阶函数也可以自己实现原创 2018-05-18 19:50:12 · 437 阅读 · 0 评论 -
python中str的特性
换行字符串how_many_snakes = 1snake_string = """Welcome to Python3! ____ / . .\\ \ ---< \ / __________/ /-=:___________/<3, Juno"""...原创 2018-05-03 17:14:35 · 606 阅读 · 0 评论 -
python函数小结
1.函数关键字一般的函数调用import math def get_cylinder(height, radian): return height*math.pi*radian**2print(get_cylinder(1,1))含有默认值的参数import math def get_cylinder(height, radian=1): ret...原创 2018-05-02 23:34:08 · 167 阅读 · 0 评论 -
python中list,dict,set的总结
list基本特性 有序可变,元素可以是任何已知的数据结构初始化 a = [] a = [1,3,54] a = [1, '34', (2,4)] 增删改查a.append()a.extend()a.pop()a.pop(index)a[0] = 'need'a.clear()x in a遍历for x in l...原创 2018-04-24 20:33:04 · 5016 阅读 · 0 评论 -
测试python程序运行时间
import timeimport decimal# text decimal_sumprint("decimal:")start =time.time()sum = decimal.Decimal('0')for x in range(100): sum += decimal.Decimal(x)end = time.time()# print('Running t...原创 2018-04-30 09:51:55 · 10350 阅读 · 1 评论 -
python遍历字典以及list转化字典,求字典元素最大值
我们先来看这样一个故事:程序员加班回家,已经是深夜了,加上路途遥远,只好坐车回去,他现在想到的交通工具如下。costs = ['bike', 'car', 'bus', 'light railway']程序员想了想:for cost in costs: print(cost)各种交通工具的价格已经贴在墙上了:costs = [['bike', 2], ['c...原创 2018-04-18 21:13:12 · 1793 阅读 · 0 评论 -
jupyter notebook 关于不同版本py共存的问题
The idea here is to install multiple ipython kernels. Here are instructions for anaconda. If you are not using anaconda, I recently added instructions using pure virtualenvs.conda create -n py27 pyt...转载 2018-04-18 07:26:03 · 828 阅读 · 0 评论