Python
文章平均质量分 50
半盒果酱
运筹优化
展开
-
[SCIP]
官方给了一些例子便于上手:Example projects八皇后问题给出了一般流程:Using SCIP's callable library for solving the n-queens problem.参数设置:list of all SCIP parameters# solving stops, if the given number of solutions were found (-1: no limit)# [type: int, advanced: FALSE, ran原创 2021-07-19 20:35:00 · 220 阅读 · 0 评论 -
【Python|matplotlib】多列堆叠图
官网大法好:点击直达官网参考:1)多列:Grouped bar chart with labels2)堆叠:Stacked bar chart我的:import matplotlibimport matplotlib.pyplot as pltimport numpy as nplabels = ['C3', 'C4', 'C5', 'C6']im_ip = [20, 34, 30, 35]cg_ip = [25, 32, 34, 20]cg_lp = [2, 3, 4原创 2020-12-03 15:29:04 · 1015 阅读 · 0 评论 -
【API】常用汇总
PythonPandas API reference: Series, DataFrame,...原创 2020-11-02 20:05:09 · 87 阅读 · 0 评论 -
【Python】日期处理-中国法定节假日
插件说的超级清楚明白且有例子https://pypi.org/project/chinesecalendar/#description1.下载插件2.cmd命令行安装:pip install chinesecalendar3.引用:import chinese_calendar 或者from chinese_calendar import is_workday, is_holiday4.示例mydate = datetime.date(2018, 4, 30)p.原创 2020-10-23 10:22:01 · 2425 阅读 · 0 评论 -
【Python】piecewise与curve_fit分段线性函数拟合
思路:确定所有的分割点(x*,y*)以及首尾的斜率(k*)参考:两段的分段函数;三段的分段函数;scipy.optimize.curve_fit代码:from scipy import optimizeimport matplotlib.pyplot as pltimport numpy as npx = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13, 14, 15], dtype=float)y = np.array([5原创 2020-06-08 15:55:41 · 7589 阅读 · 1 评论 -
【Python|Pandas】dataFrame简单操作:根据某些列生成新列
# -*- coding: utf-8 -*-"""Created on Tue Apr 24 16:42:16 2018@author: zhoulei"""import pandas as pd#import numpy as npfrom datetime import date,datetimedef read_dataFrame(fileName,sheetNam...原创 2018-05-10 16:18:59 · 14874 阅读 · 0 评论 -
【Python|matplotlib】简单作图:散点图,条形图,频数分布直方图
官网大法好:https://matplotlib.org/index.html决策树(回归)结果作图的例子:http://scikit-learn.org/stable/auto_examples/tree/plot_tree_regression.html#sphx-glr-auto-examples-tree-plot-tree-regression-py自己用到的:import matplo...原创 2018-04-10 10:45:20 · 4001 阅读 · 0 评论 -
【Python】【矩阵】协方差矩阵;特征值;特征向量
import numpy as npx = np.array([[1,1,1], [0,0,-1], [1,-1,1],[-1,1,0]]).Tprint(x)print('---------')y = np.cov(x)#协方差阵print(y)print('---------')print(np.linalg.eigvals(y))#特征值print('---------A2原创 2017-11-05 17:51:53 · 2326 阅读 · 0 评论 -
【python/热力图】从csv文件读入(x,y,z)画简单热力图
# -*- coding: utf-8 -*-"""Created on Fri Nov 10 21:20:25 2017@author: zhoulei"""# Required Packages# 回归import matplotlib.pyplot as pltimport numpy as npimport pandas as pdfrom sklearn impor...原创 2017-11-11 10:09:32 · 8395 阅读 · 3 评论