![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
guohongyanghy
这个作者很懒,什么都没留下…
展开
-
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 6: invalid start byte
由于修改了jupyter的工作空间,导致之前的代码不能运行,无法解决,就拷贝了代码和数据,放到了新的目录中,运行出错。juppyter 错误程序 read_csv时出错添加:#-*- coding : utf-8 -*-# coding: utf-8无效解决办法book=pd.read_csv("****.csv",encoding="unicode_...转载 2020-03-05 14:20:46 · 3323 阅读 · 1 评论 -
jupyter :NameError: name 'clf' is not defined
前面的的代码块中已经定义了clf,但是下面的代码块调用报错可能和%%time相关,注释了就好了原创 2020-02-28 13:38:35 · 9878 阅读 · 0 评论 -
列生成算法实现下料问题,利用gurobi计算
木材下料问题:原有三种可用木材,长度分别为9,14,16寸,价格分别为5,9,10.现在需要30块4寸,20块5寸,40块7寸木材枚举所有可能切法 子问题3求解出来的redust cost最大,将他加入到主问题中迭代求解新生成的主问题,直到主问题对应的三个子问题求解出来的redust cost都是负数,表明,当前主问题的解已...转载 2019-12-02 15:26:22 · 4067 阅读 · 1 评论 -
合并两个地址本
读文件,存进字典遍历字典进行拼接存进新文件数据结构:字典{键:值} : {姓名:电话} {姓名:邮箱}用到的方法:读文件方法:1、file1 = open(‘phone_num.txt’,‘r’)lines1 = file1.readlines()2、 with open(‘email.txt’,‘r’) as file2:lines2 = file2.readlines(...原创 2019-11-01 16:02:32 · 478 阅读 · 0 评论 -
爬取多城市空气质量数据
数据抓取url = 'http://tianqihoubao.com/aqi/beijing-201909.html'import requestsfrom bs4 import BeautifulSoupimport pandas as pdheaders = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) ...原创 2019-10-31 17:19:34 · 1445 阅读 · 0 评论