自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

爬虫 python

  • 博客(36)
  • 资源 (2)
  • 收藏
  • 关注

原创 如何根据具体地址获取经纬度

根据具体地址获取经纬度通过python调用高德地图接口,返回经纬度代码如下:import xlrdimport requestsimport json# 设置路径path = './lj_distinct_data_analysis.xlsx'# 打开execlworkbook = xlrd.open_workbook(path)# 输出Excel文件中所有sheet的名字...

2019-07-02 13:21:13 4580

原创 【爬虫实战】01利用python爬虫并进行数据分析(链家 爬虫)

爬虫实战01——利用python爬虫并进行数据分析爬取链家二手房相关信息并进行数据分析 {https://sh.lianjia.com/ershoufang/pg}一、爬虫部分背景需求来源于生活大数据时代来临,数据就是核心,数据就是生产力,越来越多的企业开始注重收集用户数据,而爬虫技术是收集数据的一种重要手段python版本:3.6.5 ,系统环境是windows,工具包:requ...

2019-06-27 20:05:06 11815 16

原创 时间序列处理

# -*- coding: utf-8 -*-"""Created on Sun Mar 27 22:56:24 2022@author: wuxian"""import pandas as pdimport datetimeimport numpy as np(datetime.date.today()).strftime('%Y-%m-%d')#H:小时 D:天 M:月#times #2016 Jul 7/1/2016 2016-07-01 2016/07/01pd.date

2022-04-28 18:21:52 364

原创 collections部分模块使用方法

from collections import Counterfrom collections import Counters = "hello-python-hello-world"a = Counter(s)print(a)# 结果 Counter({'-': 3, 'd': 1, 'e': 2, 'h': 3, 'l': 5, 'n': 1, 'o': 4, 'p': 1, 'r': 1, 't': 1, 'w': 1, 'y': 1})dict(a)#对键或者值排序 用sorted

2022-04-28 16:39:05 206

原创 python中两个字符串日期如何相减,并利用apply()处理df自定义函数

# -*- coding: utf-8 -*-"""Created on Mon Apr 12 14:04:48 2021@author: wuxian"""from datetime import datetimedef date_diff(start_date,end_date): format_pattern = "%Y-%m-%d" # 将 'str' 时间通过格式化模式转化为 'datetime.datetime' 时间戳, 然后再进行比较 differenc

2021-04-12 14:33:50 1849 2

原创 分别用mysql,python查询日期期间连续天数,并求出最大连续天数

1、 首先给出表结构:给出两种处理方法:第一种利用参数解决:set @a := (SELECT max(日期) FROM `sheet1`);set @b :=1;set @c :=1;SELECT riqi 区间最小日期,DATE_ADD(riqi,INTERVAL rank-1 day) 区间最大日期,rank '连续区间的天数' from(SELECT @b :=if(DATEDIFF(@a,日期)=1,@b+1,1) as rank,@a:=日期 as 'riqi'from

2021-04-10 14:46:09 1113 2

原创 python读取.csv 大文件的解决办法(iterator=true)

import pandas as pdimport datetimeimport warningswarnings.filterwarnings('ignore')#数据导入#调查日期today = datetime.date.today() searchdate = datetime.datetime.strftime(today, "%Y-%m-%d") path = r'C...

2020-04-04 17:38:21 3800 1

原创 mysql8.0之caching_sha2_password

dos命令环境下可以正常进入环境,但是navicat 环境下登入本地服务器的时候,出现caching_sha2_password报错该异常原因是:在mysql8之前的版本使用的密码加密规则是mysql_native_password,但是在mysql8则是caching_sha2_password。解决方案:一、创建了一个新用户,并指定加密规则为mysql_native_password:...

2020-03-24 12:53:33 389

原创 python pip升级出错的解决办法

1、升级pip的常规操作python -m pip install --upgrade pip 又或者pip install -U pip结果依旧是报错结果想到卸载重新安装,但是结果依旧是较低版本的python -m pip uninstall pippython -m ensurepip --default-pippip --version结果试了,it works!eas...

2020-03-21 13:31:44 202

原创 关于在安装navicate中出现10061问题、2059问题的解决办法

1、出现10061问题在安装完navicate连接localhost时出现10061错误,如下图所示,也就是说mysql没有起来,百度方法一:通过任务管理器将mysql启动,但在尝试过程中无效;后发现是由于之前已经装过本地服务器(很久之前装的,老版本没有卸载干净),但是由于版本过低,导致服务启动失败,于是卸载本地数据库,重新安装;1、在cmd命令窗口执行命令: sc delete mys...

2020-02-22 20:16:10 955

原创 将多个sheet合并成一个sheet导出,将多个dataframe导出至多个sheet

# -*- coding: utf-8 -*-"""Created on Mon Jan 20 13:02:27 2020@author: twx253"""import xlrdimport pandas as pdfrom pandas import DataFramefrom openpyxl import load_workbookexcel_name = 'C:...

2020-01-20 13:54:12 843

原创 百度图片爬虫demo

# -*- coding: utf-8 -*-"""Created on Wed Dec 11 17:27:29 2019@author: wuxian"""# -*- coding: utf-8 -*- import jsonimport itertoolsimport urllibimport requestsimport osimport reimport sys...

2019-12-30 14:22:27 103

原创 利用selenium实现动态网页的爬取

import refrom selenium import webdriverfrom selenium.webdriver.chrome.options import Options# 通过获取关键字职位数量def numberPositionsByKeyword(searchWord): # 创建chrome参数对象 chrome_options = Options(...

2019-12-26 16:27:14 316

原创 mysql实现日期补全功能

在接需求的时候我们可能会遇到,某月某日日期缺失的情况,但是需求方会要求把缺失日期补全,可以通过参数解决这个问题set @a := -1;set @days:= (SELECT DATEDIFF(max(create_date),min(create_date)) datediff FROM `alibaba_bi`);set @firdate:= (SELECT min(create_dat...

2019-09-24 20:33:16 548

原创 如何正确将python的DataFrame格式数据导入到mysql数据库

如何正确将DataFrame格式数据导入到mysql数据库读取数据库的操作和将数据写入到数据库还是有点不一样的将DataFrame格式数据导入到mysql数据库,采用create_engine()方法:from sqlalchemy import create_engine# create_engine('mysql+pymysql://用户名:密码@主机/库名?charset=utf8'...

2019-09-23 18:19:54 8890 4

原创 python基本语法练习

# -*- coding: utf-8 -*-"""Created on Tue Jun 11 14:27:05 2019@author: wuxian"""list6 = [1,5,2,8,10,13,17,4,6]result = []for i in list6: y = i ** 2 + 1 result.append(y)print(result)...

2019-09-22 17:40:30 174

原创 收入预测分析_practice

"""Created on Tue Jun 4 17:40:28 2019@author: wuxian"""import pandas as pdimport numpy as npimport seaborn as snsimport matplotlib.pyplot as plt##数据读取income = pd.read_excel(r'C:\Users\wuxia...

2019-09-22 17:38:26 307

原创 【机器学习实战】8_dimensionality_reduction代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

降维(主成分分析和因子分析)# -*- coding: utf-8 -*-"""Created on Fri Feb 1 16:21:14 2019@author: Administrator"""import matplotlib.pyplot as pltimport osimport numpy as npPROJECT_ROOT_DIR = 'E:\wuxian ...

2019-09-22 17:34:28 165

原创 【机器学习实战】9_deeplearning《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

深入学习入门# -*- coding: utf-8 -*-"""Created on Tue Feb 12 17:33:43 2019@author: Administrator"""# To support both python 2 and python 3from __future__ import division, print_function, unicode_lit...

2019-09-22 17:30:56 170

原创 【机器学习实战】7_集成学习_随机森林代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

集成学习_随机森林# -*- coding: utf-8 -*-"""Created on Wed Jan 30 10:02:50 2019@author: Administrator"""import matplotlib.pyplot as pltimport osimport numpy as npPROJECT_ROOT_DIR = 'E:\wuxian python...

2019-09-22 17:28:06 213

原创 【机器学习实战】6_decision_trees代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

decision_trees(iris_dataset)# -*- coding: utf-8 -*-"""Created on Mon Jan 28 15:35:48 2019@author: Administrator"""from sklearn.datasets import load_irisfrom sklearn.tree import DecisionTreeCl...

2019-09-22 17:10:34 246

原创 【机器学习实战】5_SVM代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

SVM# -*- coding: utf-8 -*-"""Created on Wed Jan 16 16:30:13 2019@author: Administrator"""from sklearn.svm import SVCfrom sklearn import datasetsimport numpy as npimport matplotlib.pyplot as...

2019-09-22 17:05:12 234

原创 【机器学习实战】4_Training_Linear_Model代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

训练线性模型# -*- coding: utf-8 -*-"""Created on Mon Jan 7 19:32:56 2019@author: Administrator"""'''Linear regression using the Normal Equation'''# =================================================...

2019-09-22 17:02:56 174

原创 【机器学习实战】3_Classification代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

手写数字图片分类# -*- coding: utf-8 -*-"""Created on Tue Dec 25 13:43:39 2018@author: Administrator"""#from sklearn.datasets import fetch_mldataimport numpy as npimport scipy.io as ioimport osimpor...

2019-09-22 16:59:18 344

原创 python实战-echarts-关系型图(无向图)可视化

# -*- coding: utf-8 -*-"""Created on Wed Jul 17 18:32:43 2019@author: wuxian"""from pyecharts import Graph nodes = [{"name": "结点1", "symbolSize": 1}, {"name": "结点2", "symbolSize": 2...

2019-07-25 15:09:43 2411

原创 git 常用指令

pwd //查看路径cd d:/jupiter/ //更改文件路径git status //查看仓管文件更改情况git clone https://gitee.com/twx253/GoodFish.git //克隆一个本地库git add 文件 //将文件添加到暂存区git add . //将所有修添加到暂存区git commit -m '注释' //将暂存区的修改...

2019-07-17 12:16:24 117

转载 【爬虫实战】【微信】如何利用python爬取APP评论-本文以ios爬取微信评论

# -*- coding: utf-8 -*-"""Created on Tue Jul 2 16:26:50 2019@author: wuxian"""#完整程序如下:import requestsimport redef getHTMLText(url): try: r = requests.get(url) r.raise_f...

2019-07-16 10:08:48 961

原创 【机器学习实战】2_predict_median_house_values代码《Hands-On Machine Learning with Scikit-Learn&TensorFlow》

# -*- coding: utf-8 -*-"""Created on Mon Dec 17 14:53:17 2018@author: Administrator"""#from __future__ import division,print_fuction,unicode_literals#os 模块提供了非常丰富的方法用来处理文件和目录。import os#impor...

2019-07-15 20:02:10 413

原创 【机器学习实战】1_GDP预测案例代码《Hands-On Machine Learning with Scikit_Learn &TensorFlow》

# -*- coding: utf-8 -*-"""Created on Fri Dec 14 13:45:58 2018@author: Administrator"""#import matplotlibimport matplotlib.pyplot as pltimport numpy as npimport pandas as pdimport sklearn#f...

2019-07-12 18:50:57 1396 3

原创 【自动邮件】如何利用python自动发邮件(附件excel发送)

自动发送邮件可以将常规化得需求自动化,解放双手做更多有意义的事情

2019-07-03 19:46:37 1533

转载 【微信】利用python实现微信好友防撤回、消息监控

# -*- coding: utf-8 -*-"""Created on Fri Jun 21 12:09:43 2019@author: wuxian"""import sysimport os, re, shutil, time, collections, jsonfrom html.parser import HTMLParserfrom xml.etree impor...

2019-07-03 10:04:10 1368

原创 【微信】利用python分析微信好友各维度信息

想要知道你的微信好友性别分布嘛,想知道盆友分布在全国哪个省、哪个城市嘛,想要知道盆友喜欢什么嘛(签名),快来看看吧

2019-07-02 19:21:51 274

原创 excel如何拆分工作簿——VBA实现

用VB实现Sub 拆分工作簿() Application.ScreenUpdating = False '关闭屏幕闪动,提速 Application.DisplayAlerts = False '关闭窗口提示 kk = 2 Set dic = CreateObject("scripting.dictionary") With ThisWorkbook.Wo...

2019-06-28 18:50:06 1369

原创 mysql使用过程中一下小技巧总结

Mysql 执行顺序:from——>where——>groupby——>having——>select——>order by

2019-06-28 17:16:02 144

原创 数据准备工作:区分新老户(自建表或存函实现)

场景:区分未下单/下过订单的用户####区分新老户#######drop table if exists new_old_distingush;create table new_old_distingushSELECT user_id,nid,apply_time,firstend_oldstart_time,if(TIMESTAMPDIFF(second,firstend_oldsta...

2019-06-28 15:58:13 218

原创 利用mysql对文本数据进行处理

爬虫实战01——数据预处理(mysql)除了利用pandas模块进行数据处理, 还可以利用mysql进行处理将爬虫下来的数据导入mysql,并进行数据处理:DROP TABLE if exists a.*; CREATE TABLE a.* # 新建数据表(SELECT DISTINCT hou_code ,#f1+1 id,infotitle 标题,alt 地标_1,p...

2019-06-28 15:32:57 342

2019中国互联网趋势报告-高瓴.pdf

2019年中国互联网趋势报告 创新产品+商业模式 (高领资本)

2019-06-28

数据挖掘中十大经典算法.pdf

数据挖掘中十大经典算法,包括分类决策树算法、K-means算法、SVM、朴素贝叶斯等

2019-06-28

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除