![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据
DwyanePeng
这个作者很懒,什么都没留下…
展开
-
seaborn画图
import pandas as pd dataset = pd.read_csv("E:\data\cal_housing.csv")print("Dataset: {}".format(dataset.shape))print("Columns: {}".format(dataset.columns))dataset.head(5)import matplotlib.pyplo...原创 2019-10-17 17:39:47 · 319 阅读 · 0 评论 -
Tensorflow分布式训练
#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : 2019/10/10 13:50# @Site : # @File : distributed_MNIST.py# @Software: PyCharmimport tensorflow as tffrom tensorflow.contrib.learn...原创 2019-10-11 16:36:50 · 368 阅读 · 0 评论 -
python多进程和串行运行
#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : 2019/10/8 10:40# @Site : # @File : 多进程_串行.py# @Software: PyCharmimport timeimport multiprocessingdata = range(8)def muchjob(x...原创 2019-10-08 11:06:37 · 444 阅读 · 0 评论 -
正则匹配护照格式
美国、英国护照号码:9 位数字 加拿大护照:2 个字母加 6 个数字 法国护照:2 个数字加 2 个字母加 5 个数字 意大利护照:2 个字母加 7 个数字 西班牙护照:3 个字母加 6 个数字 德国护照:9 个字符,由 2-3 个数字与 6-7 个字母混排,头尾是字母。或者单纯为 9 个数字def foreign_passport(sentence): pattern = [r'...原创 2019-09-20 16:46:07 · 5158 阅读 · 0 评论 -
判断字符串中是否有身份证号码
# -*- coding: utf-8 -*-import reclass Solu:# Errors=['验证通过!','身份证号码位数不对!','身份证号码出生日期超出范围或含有非法字符!','身份证号码校验错误!','身份证地区非法!'] def checkIdcard(self, idcard): Errors = ['验证通过!', '身份证号码位数不对...原创 2019-09-18 18:22:06 · 2292 阅读 · 0 评论 -
mysql查询在一个表而不在另一个表中的数据
select C.company_name,C.company_address from Companylist C left join "company_LoAndLa" L on C.company_name=L.company_name where L.company_name is null其他两种写法:select distinct A.ID from A where A.I...原创 2019-09-18 09:10:25 · 636 阅读 · 0 评论 -
scrapy 通过命令行传参数批量爬取
class EypSpider(scrapy.Spider): name = 'eyp' def __init__(self, category=None, *args, **kwargs): super(EypSpider, self).__init__(*args, **kwargs) cat = [category, category] ...原创 2019-09-10 16:09:42 · 548 阅读 · 0 评论 -
python 读取本地excel存入数据库
import pandas as pdimport osfrom read_pgdata import Postgredataroot_dir = r'root'file_names = os.listdir(root_dir)[:-1]print(len(file_names), file_names)pg = Postgredata()for i in range(len(...原创 2019-09-02 11:44:40 · 550 阅读 · 0 评论 -
查询表中第一个下订单的用户id和订单id
滴滴笔试题order_list表:userid,orderid,start_timeselect userid,orderid from order_list awhere(select count(*) from order_list b where b.start_time<a.start_time)<=1 selectuserid,orderidf...原创 2019-08-29 17:33:40 · 2456 阅读 · 0 评论 -
python时间格式转换
import time, datetimenow = datetime.datetime.now()ago = now - datetime.timedelta(days=30)print(ago.strftime("%Y-%m-%d %H:%M"))输出:2019-07-30 15:51得到30天前的时间。原创 2019-08-29 15:51:54 · 222 阅读 · 0 评论 -
python RPC原理
rpc远程调用原理 :比如 A调用B提供的remoteAdd方法:首先A与B之间建立一个TCP连接;然后A把需要调用的方法名(这里是remoteAdd)以及方法参数(10, 20)序列化成字节流发送出去;B接受A发送过来的字节流,然后反序列化得到目标方法名,方法参数,接着执行相应的方法调用(可能是localAdd)并把结果30返回;A接受远程调用结果,然后do()。RPC框...原创 2019-08-28 16:41:50 · 368 阅读 · 0 评论 -
Postgresql 数据库操作类
# -*- coding: utf-8 -*-'''Postgresql 数据库操作类'''import psycopg2import json# import pandas as pd# 从postgresql获取数据class Postgredata(): def __init__(self): self.dbname = "----" ...原创 2019-08-16 18:46:33 · 270 阅读 · 0 评论