![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
wangdi_37927
这个作者很懒,什么都没留下…
展开
-
【python】book爬虫、数据清洗与可视化实战2
import requestsimport timeimport pandas as pd# 加载pymongo库iimport pymongo#建立连接client = pymongo.MongoClient('localhost',27017)# 在MongoDB中新建名为weather的数据库book_weather=client['weather']# 在weathe...原创 2019-12-08 21:56:11 · 341 阅读 · 0 评论 -
Python网络数据采集--第二章
from urllib.request import urlopenfrom bs4 import BeautifulSoup##2.1#我们可以抓出整个页面,然后创建一个BeautifulSoup 对象html = urlopen("http://www.pythonscraping.com/pages/warandpeace.html")bsopj = BeautifulSoup(...原创 2019-11-05 09:50:35 · 182 阅读 · 0 评论 -
【python小甲鱼7】文件
def file_write(file_name): f = open(file_name,'w') print('请输入内容【单独输入\':w\'保存退出】:') while True: write_some = input() if write_some != ':w': f.write('%s\n' ...原创 2018-10-30 12:36:56 · 389 阅读 · 0 评论 -
【python小甲鱼6】集合
用{}括起来的,没有映射关系的,就是集合。集合的特点:1.元素唯一。num = {4,1,2,3,4,2,4,2}print(num)#运行结果为{1, 2, 3, 4}2.无序。eg:num[2]就会报错。 创建集合:1.直接把一堆数用{}括起来。2.工厂函数set().3.创建不可变集合frozenset()....原创 2018-10-29 19:46:35 · 139 阅读 · 0 评论 -
【python小甲鱼5】字典
字典{};元组();列表[]。字典的key和value值既可以是整型,也可以是字符串类型 。创建字典:fromkeys()、访问字典:keys(),values(),items(),get()修改字典:get(),a=b和a=b.copy()的区别啊!!...原创 2018-10-29 09:55:57 · 122 阅读 · 0 评论 -
【python小甲鱼4】函数——递归
def digui(n): if n==1: return 1 if n ==2: return 1 else: return digui(n-1)+digui(n-2)print(digui(10))原创 2018-10-28 19:08:23 · 246 阅读 · 0 评论 -
【python小甲鱼1】序列
#1list-把。。。变成列表[]a = list()print(a)b = 'I LOVE WANGDI'#序列b = list(b)print(b)c = (1,1,2,3,5,8,13,21,34)#这是元组哦c = list(c)#把元组变成列表了print(c)#2tuple——把一个可迭代对象变成元组tuple(c)print(c)#3max、min——返回...原创 2018-10-28 10:46:26 · 146 阅读 · 0 评论 -
【python】案例实战:使用sklearn构造决策树模型
import matplotlib.pyplot as pltimport pandas as pdfrom sklearn.datasets.california_housing import fetch_california_housinghousing = fetch_california_housing()print(housing.DESCR)print(housing....原创 2018-08-06 17:05:24 · 3784 阅读 · 0 评论 -
Python: sklearn库中数据预处理函数fit_transform()和transform()的区别
原帖:https://blog.csdn.net/quiet_girl/article/details/72517053敲《Python机器学习及实践》上的code的时候,对于数据预处理中涉及到的fit_transform()函数和transform()函数之间的区别很模糊,查阅了很多资料,这里整理一下: 涉及到这两个函数的代码如下: # 从sklearn.pre...转载 2018-07-21 16:34:45 · 2003 阅读 · 0 评论