![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
秉寒-CHO
但行好事,莫问前程
展开
-
python 3.x 中 map ,sorted ,filter ,reduce 与lambda function 的混合使用案例
#python 中的几个内置函数使用学习,向潘石屹先生学习....def sq(x): return x*xprint(map(sq,[y for y in range(10)]))# map function # map() 会根据提供的函数对指定序列做映射。# 第一个参数 function 以参数序列中的每一个元素调用 function 函数,返回包含每次 function 函数返回值的新列表。# 语法 : map(function ,iterable,...) 可以接收多...原创 2020-09-22 17:21:37 · 116 阅读 · 0 评论 -
你可知道python 中for 和 else 可以连用
jh_joan_list =list()for x in range(10): jh_joan_list.append(x)else : jh_joan_list.append('done')print(jh_joan_list)# the result: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'done']原创 2020-01-21 16:52:02 · 743 阅读 · 1 评论 -
ranking 排序图
#ranking 排序图 import numpy as npimport pandas as pd import matplotlib.pyplot as pltimport seaborn as snsimport matplotlib as mpl%matplotlib inlineX = [x for x in range(1,6)]Xy =[14,13,33,1...原创 2019-12-22 13:49:53 · 439 阅读 · 0 评论 -
python 偏差图
import syssys.version#deviation ## 偏差图 是单个特征中的所有值跟特定值之间的关系图 ,#反应的是所有值偏离特定值得距离#典型的偏差图:面积图,发散性条形图#1.发散条形图#如果你也想根据单个指标查看项目的变化情况,并且可视化此差异的顺序和数量,它有助于快速的区分#数据中的组的性能,非常直观import pandas as pd im...原创 2019-12-22 02:16:12 · 1330 阅读 · 0 评论 -
python 散点图
python的画图功能强大 ,为了加强对python的基础认识 ,通过对相关语法的了解 ,加深认识本期是python 三点图 scatterplot#d导入需要会的绘图库import numpy as npimport pandas as pd import matplotlib as mplimport matplotlib.pyplot as plt import seab...原创 2019-12-22 00:42:08 · 596 阅读 · 0 评论 -
Top 50 matplotlib Visualizations – The Master Plots (with full python code) 个人分析
SetupRun this once before the plot’s code. The individual charts, however, may redefine its own aesthetics.# !pip install brewer2mplimport numpy as npimport pandas as pdimport matplotlib as...原创 2019-12-21 17:59:23 · 2164 阅读 · 0 评论 -
Python 线程和 redis 简单读写操作应用
Python 线程和 redis 简单读写操作应用1. python 线程 & 线程池的概念python 中使用线程的两种方式: 函数或是用类包装线程对象函数:调h用thread 模块中的start_new_thread()函数生成新线程,thread.start_new_thread(function,args[,kwargs])参数说明:function ---> 线程函数原创 2017-09-19 13:38:22 · 1870 阅读 · 0 评论 -
深度学习之Python 脚本训练keras mnist 数字识别模型
本脚本是训练keras 的mnist 数字识别程序 ,以前发过了 ,今天把 预测实现了,# Larger CNN for the MNIST Dataset# 2.Negative dimension size caused by subtracting 5 from 1 for 'conv2d_4/convolution' (op: 'Conv2D') with input shapes# ...原创 2018-03-08 20:48:44 · 2229 阅读 · 0 评论 -
Python 生成均值为2 ,标准差为3 的一维正态分布样本500
Python 生成均值为2 ,标准差为3 的一维正态分布样本500 import numpy as npimport scipy.stats as st import matplotlib.pyplot as plts=np.random.normal(2, 3, 500)s_fit = np.linspace(s.min(), s.max())plt.plot(s_fit,...原创 2018-12-04 16:02:29 · 7530 阅读 · 0 评论 -
用Python 根据文件名查找数据文件
#-*- coding: UTF-8 -*-import osimport shutilAllFiles=[]NameFiles=[]def findFie(filePath): pathDir = os.listdir(filePath) for allDir in pathDir: # print(allDir) AllFiles.app原创 2017-09-08 17:41:47 · 3335 阅读 · 0 评论 -
Keras CNN 数字识别
难点是版本变化后 方法不再匹配 ,同时每个方法具体意义需要揣摩# Larger CNN for the MNIST Dataset# 2.Negative dimension size caused by subtracting 5 from 1 for 'conv2d_4/convolution' (op: 'Conv2D') with input shapes# 3.UserWar原创 2017-08-29 20:41:25 · 3738 阅读 · 4 评论 -
python scala kafka 集成一个流程项目 spark
想在windows 下 ,搭建一个spark kafka 的 最简单的实时流计算:python 随机生成0-100 的随机数据,发送给spark 进行统计scala 2.11python 3.5java 1.8kafka_2.11-0.11.0.0.tgzzookeeper-3.4.9.tar.gzspark 2.2step 1 zk 配置 ,启动zk原创 2017-08-19 13:54:05 · 539 阅读 · 0 评论 -
python 实现table name 首字母大写 (驼峰)
要点:数据分割数据集成stringId='DMDM_SUM_FACT_PATTERN_CHANLLAGE_POC_MQT'print stringId.capitalize()stringList = stringId.split('_')stringListAfter= []for x in stringList: stringListAfter.appen原创 2017-08-10 12:10:07 · 1287 阅读 · 3 评论 -
最简单的python 爬虫
C:\Users\IBM_ADMIN>python -VPython 2.7.13查Python 工资的网站 :http://www.jobui.com/salary/%E5%8C%97%E4%BA%AC-python%E5%B7%A5%E7%A8%8B%E5%B8%88/# -*- coding:utf-8 -*-import re,urllib2url = 'http:原创 2017-08-09 21:14:33 · 456 阅读 · 0 评论 -
python 案例 012(snake)
这个模块还需要更多时间了解import randomimport curses'''By wumi 2017-7-23https://www.youtube.com/watch?v=rbasThWVb-cCurses 使用介绍:http://www.cnblogs.com/starof/p/4703820.html'''s = curses.initscr()原创 2017-07-23 15:52:16 · 1215 阅读 · 0 评论 -
深度学习 python 脚本实现 keras mninst 数字识别 预测端 code
import numpyimport skimage.ioimport matplotlib.pyplot as pltfrom keras.models import Sequentialfrom keras.layers import Densefrom keras.layers import Dropoutfrom keras.layers import Flattenfr...原创 2018-03-08 20:52:28 · 947 阅读 · 0 评论 -
懵逼,同事前几天问我一个udf 问题 ,还是 Python 格式的
以前所有的Hive 函数都是 Java 或是 Scala 语言写的 ,Python 没有弄个 ,看到Python 格式的 code 懵逼了 ,非常懵逼 今天在看 Python 正则表达式偶遇 Python udf 的一个 case ,不过 Python 484 not support udaf or udtf ?? I have know idea now .fuck...原创 2018-10-31 18:05:33 · 432 阅读 · 0 评论 -
jieba 分词 与 TF-IDF 提取文章关键字 核心code - sxr
#!/usr/bin/env python# -*- coding: utf-8 -*-import jieba.analyseimport sysreload(sys)sys.setdefaultencoding('utf8') ##UnicodeWarning: Unicode equal comparison failed to convert both argument...原创 2019-03-21 19:49:20 · 498 阅读 · 0 评论 -
python caffe 配置 步骤 第二篇文章
上篇blog 有意境编译好的caffe ,本部主要是配置caffe 下 python 接口应用5.编译后可执行的文件在,caffe中的Bulid\x64\release下面(包括caffe.exe、convert_imageset.exe等经常要用到的文件)添加环境变量,我的路径是D:\caffe\Build\x64\ReleaseD:\caffe\Build\x64\Releas...原创 2019-03-13 13:24:13 · 293 阅读 · 0 评论 -
caffe cifar 图像识别的第三篇文字
第一篇文件介绍了caffe 安装编译事宜https://blog.csdn.net/haohaixingyun/article/details/88177725 第二篇文章介绍了在编译后的caffe中构建pycaffe 的过程https://blog.csdn.net/haohaixingyun/article/details/88530430第三篇是构建 提取caffe 的ip1...原创 2019-03-14 08:46:07 · 237 阅读 · 0 评论 -
svm util tool
#!/usr/bin/env pythonimport osimport sysfrom svm import *from svm import __all__ as svm_all__all__ = ['evaluations', 'svm_load_model', 'svm_predict', 'svm_read_problem', 'svm_save_...原创 2018-12-18 14:26:49 · 516 阅读 · 0 评论 -
Python interface of LIBSVM
------------------------------------- Python interface of LIBSVM -------------------------------------Table of Contents=================- Introduction- Installation- Quick Start- Design Desc...转载 2018-12-18 11:22:51 · 249 阅读 · 0 评论 -
图像处理的几种方法
图像处理的几种方法 1.使用skimage name details name details name details astronaut 宇航员图片 coffee 一杯咖啡图片 lena lena图片 camera 拿相机的人图片 coins 硬币 moon 月...转载 2018-12-17 09:09:41 · 2401 阅读 · 1 评论 -
15道AI 机器学习笔试题(暂时没有答案)
原创 2018-11-26 09:09:02 · 702 阅读 · 0 评论 -
The most important parameters of spark env when you using spark run data things
The most important parameters of spark env when you using spark run data thingsIn my memory I always confused by these parameters ,so it's a good time to understand them totally thanksThere ar...原创 2018-11-02 16:39:56 · 152 阅读 · 0 评论 -
python 案例 011(猜数值)
#! /usr/bin/env python# coding:utf-8import random"""Guesser number ,by wumi ,2017-07-22"""def main(): print "guess a number between 1 to 100,how many time you guessed it" randNumber =原创 2017-07-22 21:14:07 · 291 阅读 · 0 评论 -
python 案例010(求质数)
重点是什么是质数,以及怎么求质数#!/usr/bin/python# -*- coding:UTF-8 -*-'''Findprime number判断101-200之间有多少个素数,并输出所有素数。何为素数:质数(外文名prime number)又称素数,有无限个。质数定义为在大于1的自然数中,除了1和它本身以外不再有其他因数,这样的数称为质数。'''L = []原创 2017-07-18 23:23:16 · 393 阅读 · 0 评论 -
python 案例 009 (睡眠,时间format)
#!/usr/bin/python# -*- coding:UTF-8 -*-import time"""pause for 2 seconds and format the timestamp"""def pause(n): for x in range(10): print x print time.strftime('%Y/%m/%d原创 2017-07-18 22:35:25 · 373 阅读 · 0 评论 -
Python 文件夹遍历和文件查找
# -*- coding: utf-8 -*-#to find where use the table on xxxxx xxxxxx production env'''在项目中我们元数据管理的不是很好,如果先知道一张表在哪里用过,就需要写个程序去遍历下'''import osimport os.pathrootdir = "C:\\Users\\IBM_ADMIN\\I原创 2017-05-25 15:49:13 · 7564 阅读 · 0 评论 -
Applications of Python
import xml.dom.minidomimport osimport sysimport zipfileimport shutilimport datetimefrom os import pathdef main(): #working with xml doc=xml.dom.minidom.parse("samplexml.xml"); prin原创 2017-04-04 16:23:29 · 281 阅读 · 0 评论 -
Working with Generators of Python
#enumerate#seasons=['spring','summer','autumn','winter']seasons=('spring','summer','autumn','winter') # env tuple is works ,but after enumerate it will be listprint seasonsprint list(enumerate(sea原创 2017-04-01 19:27:28 · 271 阅读 · 0 评论 -
Decorators ,Lambda Functions and Sequences of Python
#using Decorators not understand reallyimport operatorclass Files: def __init__(self,**kwargs): self.properties =kwargs def copy(self): print "copying" def move(self):原创 2017-04-01 18:13:50 · 207 阅读 · 0 评论 -
exception handling of Python
#exception handling of Python#how to do with the exception just like java#raising exceptions#multiple exceptions#geniric exception#ignoring exception how about pass#raising excpetiondef rea原创 2017-04-01 17:03:12 · 300 阅读 · 0 评论 -
Object Oriented Python
#! usr/bin/python# #coding=utf-8 # for chinese#overview of classes and Methodsclass data(object): print __name__ def __init__(self,value): self._v = value print "this is原创 2017-04-01 15:28:22 · 356 阅读 · 0 评论 -
推荐系统之协同过滤
推荐方法称为协同过滤。顾名思义,这个方法是利用他人的喜好来进行推荐,也就是说,是大家一起产生的推荐。他的工作原理是这样的:如果要推荐一本书给你,我会在网站上查找一个和你类似的用户,然后将他喜欢的书籍推荐给你原创 2017-04-10 20:32:19 · 324 阅读 · 0 评论 -
Sequcences and Sorts in Python介绍
from operator import itemgetter,attrgetterdef main(): #range function mynms =list(range(10,20,2)) print mynms print sorted([1,3,5,6,7,1,6,8,5,8,9,6,4,2,2]) print sorted(['a','h','原创 2017-04-01 13:40:00 · 236 阅读 · 0 评论 -
Python Data Structures (数据结构)
#Python Data Structures#working with listswords = "the quick brown for jumps over the lazy dog".split()print(words)info = [[w.upper(),w.lower(),len(w)] for w in words]for data in info: print原创 2017-03-29 23:07:30 · 918 阅读 · 0 评论 -
Python 机器学习 简单实现
程序使用版本 :Python 3.4 安装对应版本的依赖numpy , scipy , matplotlib , scikit_learn参考 http://blog.csdn.net/zouxy09/article/details/48903179http://www.jianshu.com/p/21b758541825 #!usr/bin/env pytho原创 2016-07-29 19:42:11 · 3477 阅读 · 2 评论 -
Python数据爬虫,爬链家的二手房信息
# -*- coding:utf-8 -*-from bs4import BeautifulSoup原创 2016-07-06 16:03:05 · 1640 阅读 · 0 评论 -
用python 重命名文件夹下文件
# -*- coding: utf-8 -*-import os'''Description: when we load xls data into unix ,the file name with some space while our process can not recognise those file, so we want to write a samll a原创 2017-06-07 11:46:08 · 1176 阅读 · 0 评论