- 博客(50)
- 资源 (13)
- 收藏
- 关注
原创 解决django前端使用iframe标签报错127.0.0.1 refused to connect.
解决方法settings.py中配置ALLOWED_HOSTS,结果如下:ALLOWED_HOSTS = ['*']settings.py中配置MIDDLEWARE,注释XFrameOptionsMiddleware,结果如下:MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', '
2021-01-30 13:53:39 1521
原创 django自动转化前端模板中static的css,js引用
在导入前端模板时,总是要手工处理所有引用,这里写一份代码,解决这个问题:import redef change_static(script_origin: str): script_origin = script_origin.split('\n') for script_origin in script_origin: script_origin = script_origin.strip() if script_origin:
2021-01-30 13:45:46 211
转载 python查找子字符串出现的所有位置
Python字符串的类方法中,index、find、rindex等函数都是只能查找一次字符串出现的位置,尴了个尬,所以我们需要正则表达式自己写一个:import re[substr.start() for substr in re.finditer(子字符串, 原字符串)]煮个栗子:>>> somestr = 'sld;fjjnfa;sdjfsdfjnfj;ajfsjnfdjfnjnffejnf'>>> sub = 'jnf'>>> imp
2021-01-30 13:40:28 5443 1
原创 django报错‘staticfiles‘ is not a registered tag library
django在前端模板中使用{% load staticfiles %}会报错,报错信息如下:'staticfiles' is not a registered tag library. Must be one of:admin_listadmin_modifyadmin_urlscachei18nl10nlogstatictz解决方法修改前端模板为{% load static %}因为在django3.x中这部分做了修改,对于:{% load staticfiles %}{
2021-01-30 11:48:36 10330 13
原创 解决Some index files failed to download.They have been ignored, or old ones used instead报错
使用sudo apt-get update后报错:Err:1 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu bionic InRelease Temporary failure resolving 'ppa.launchpad.net'Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease Temporary failure resolving 'securit
2021-01-30 09:09:16 21778 8
原创 Mac os更新系统后安装scrapy报错error: command ‘xcrun‘ failed with exit status 1
查看报错信息:In file included from src/twisted/test/raiser.c:4:In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:In file included from /Library/Developer/CommandLineTools/
2021-01-29 01:17:34 534 1
原创 解决ipad,ios录屏保存失败-5823
解决方法方法一:确保全程关闭自己的麦克风,也就是不能发言。一旦不慎打开麦克风,全盘皆输。方法二:长按录制按钮后,关闭麦克风。(但这会导致录制只有视频没有音频)问题解析这应该是ios的保护措施,或者说是设计的问题,而我在mac上或windows上都不会有这样的问题。...
2021-01-25 19:43:34 8178
原创 linux查看主机硬件命令
文章目录查看系统信息查看cpu查看网络信息查看硬盘查看内存查看系统信息uname -a查看cpu使用:lscpu查看网络信息ifconfig查看硬盘df -lh查看内存cat /proc/meminfo
2021-01-24 18:26:19 216
原创 Easyconnect mac版本下载地址
下载地址:http://download.sangfor.com.cn/download/product/sslvpn/pkg/mac_ec_sp/EasyConnect.dmg
2021-01-24 17:23:45 41320 31
原创 Linux 通过命令行下载、上传文件到百度网盘(bypy)
安装pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ bypy或ubuntu:pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ bypy可以使用下面的代码直接运行:python3 -m bypy 下载文件上传文件
2021-01-24 11:45:18 1614 1
原创 python随机化序列与设置随机种子
随机化序列import randoma = [1, 2, 3, 4, 5, 6]random.shuffle(a)print(a)配置随机种子import randoma = [1, 2, 3, 4, 5, 6]random.Random(0).shuffle(a)print(a)
2021-01-24 08:59:28 587 2
原创 pandas追加写入行、列
文章目录追加写入行追加写入列追加写入行import pandas as pdfor i in range(2): x = [1, 2, 3, 4] df = pd.DataFrame(x) df.to_csv('data.csv', mode='a', header=False, index=False)写入结果:12341234追加写入列import pandas as pdfor i in range(2): x = [1, 2, 3
2021-01-23 15:01:52 3936 1
原创 时间序列绘制ACF与PACF图像
绘制acf与pacf图像代码如下:其中AR模型看PACF,MA模型看ACFfrom statsmodels.graphics.tsaplots import plot_acf, plot_pacfimport pandas as pdimport matplotlib.pyplot as pltimport numpy as npdf = pd.DataFrame(np.random.randint(1, 10, size=(365, 1)), columns=['value'], index
2021-01-23 13:26:44 7459
原创 时间序列趋势分解 seasonal_decompose
文章目录生成数据:乘法序列分解加法序列分解乘法序列 = Trend * Seasonality * Error生成数据:import numpy as npimport pandas as pdfrom statsmodels.tsa.seasonal import seasonal_decomposeimport matplotlib.pyplot as pltdf = pd.DataFrame(np.random.randint(1, 10, size=(365, 1)), column
2021-01-23 13:11:11 15998 10
原创 使用python做格兰杰因果检验
格兰杰因果关系检验的结论是一种统计估计,它先假设时间序列之间没有因果关系, 然后检验能否否定,如果能否定这个检验,那么这就可以验证这份时间序列数据对想要预测的目标是有效的。目标使用b预测a,a是要得出预测结果的序列:from statsmodels.tsa.stattools import grangercausalitytestsimport pandas as pdimport numpy as npdf = pd.DataFrame(np.random.randint(0, 100, si
2021-01-23 11:31:28 13638 20
原创 python序列计算变异系数
import numpy as np # coefficient of variationdef cov(se): return np.mean(se)/np.std(se) # 使用方法cov(dataframe['列名'])
2021-01-22 13:49:39 3431 2
原创 使用selenium启动(无界面)浏览器的隐私模式
核心代码options.add_argument("--incognito") # 配置隐私模式options.add_argument('--headless') # 配置无界面例如:Chromefrom selenium.webdriver.chrome.options import Optionsfrom selenium import webdriverurl = 'https://www.baidu.com'options = Options()options.add_arg
2021-01-22 00:04:59 2802
原创 使用python GluonTS库做概率预测
文章目录工具包使用代码工具包使用GluonTS工具包,主页:https://ts.gluon.ai/github页面:https://github.com/awslabs/gluon-ts/使用代码非官方代码,是我学习时测试的代码,并且尽可能标注了注释:import pandas as pdimport matplotlib.pyplot as pltfrom gluonts.dataset.common import ListDatasetfrom gluonts.mx.trainer
2021-01-21 23:46:13 1820
原创 sklearn随机森林展示各个特征权重
核心代码使用 feature_importances_可以提取随机森林的特征排序rf_model.feature_importances_案例创建数据:import pandas as pdimport numpy as npx = pd.DataFrame(np.random.randint(0,100,size=(50, 3)))y = pd.DataFrame(np.random.randint(0,5,size=(50, 1)))切分训练集与测试集:from sklearn
2021-01-19 22:29:52 6855 5
原创 pandas重采样时指定对不同列的不同操作
以一个dataframe为例:import pandas as pdimport numpy as npdataframe = dataframe.resample('D').agg({ 'UnitPrice':np.mean, # 对'unitprice'这一列重采样时做均值 'num':np.sum, # 对'num'这一列重采样时做求和})然后可以查看:dataframe.head()得出下面的效果: UnitPrice num 2010-12-01
2021-01-19 10:27:05 866
原创 seaborn保存图片
dataframe改为自己的Dataframe即可fig = sns.lineplot(x=dataframe.index, y=dataframe['value'],)然后使用:scatter_fig = fig.get_figure()scatter_fig.savefig(fig_path, dpi = 400)
2021-01-14 16:12:24 5637
原创 pandas 使用把dataframe变为series
可以参考:https://blog.csdn.net/weixin_35757704/article/details/89789732比如选取第一列:dataframe.iloc[:,0]选取第一行:dataframe.iloc[0,:]
2021-01-14 15:27:40 9136 1
原创 from gluonts.trainer import Trainer报错
解决方法:修改为:from gluonts.mx.trainer import Trainer其余不变问题解析官网已经修改了源代码,但是没有修改教程:warnings.warn( "gluonts.trainer is deprecated. Use gluonts.mx.trainer instead.", DeprecationWarning, stacklevel=2,)...
2021-01-14 13:44:01 1550
原创 pip安装gluonts
gluonts需要mxnet,所以依次安装即可pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ mxnet gluonts
2021-01-14 12:36:13 1383
原创 Mac chrome 无法打开/启动
解决方法打开Activity monitor,在搜索框中搜索chrome关闭所有有谷歌chrome的图标的应用问题解析代码中使用chrome driver调用chrome后,就容易导致chrome无法打开,这估计是个bug,只需要关闭chrome后即可...
2021-01-13 18:24:28 3475
原创 TurtleCoin节点搭建
搭建节点官网地址:https://turtlecoin.lol/github地址:https://github.com/turtlecoin/turtlecoinwget https://github.com/turtlecoin/turtlecoin/releases/download/v1.0.0/turtlecoin-linux-v1.0.0.tar.gztar -zxvf turtlecoin-linux-v1.0.0.tar.gzcd turtlecoin-v1.0.0/启动节点.
2021-01-13 17:37:26 489
原创 Linux(Ubuntu18.04)安装SEAL-python
github网站:https://github.com/Huelse/SEAL-Python安装方法如下:首先判断python的版本,暗转对应的python3.x-dev,比如python3.6.10,就安装:sudo apt-get install python3.6-dev编译:sudo apt-get install build-essential cmake python3 python3-dev python3-pipgit clone https://github.com/
2021-01-13 13:52:12 1093 9
原创 解决安装CMake报错:Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly.
解决方法:方法一:使用:cmake --version如果cmake版本正常显示,则使用:hash -r方法二:如果cmake有问题,则卸载已有的cmake后重新安装:sudo apt-get remove cmake cmake-data升级cmake的版本请参考:ubuntu18.04升级cmake...
2021-01-13 13:22:19 12723 1
原创 ubuntu18.04升级cmake
下载cmakecmake官网:https://cmake.org/download/sudo apt-get install -y build-essential libssl-devwget https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2.tar.gztar -zxvf cmake-3.19.2.tar.gz配置cmakecd cmake-3.19.2/./bootstrap然后可以看到结尾
2021-01-13 13:13:25 8526 9
转载 HTML实现流星雨
效果图代码<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>流星雨</title> <script> var context; var arr = new Array(); var starCount = 800; var rains = new Array();
2021-01-13 12:13:45 51130 9
原创 python函数注解
函数参数类型注解def test(a: str): # 声明传入的a是字符串类型 print(a)test("aa")函数返回值类型注解返回单个值:def test() -> str: return "aaa"b = test()print(b)返回多个值:from typing import Tupledef test() -> Tuple[str, int]: return "aaa", 1b = test()print(b
2021-01-13 11:18:25 677
原创 python查看与修改工作目录
查看当前路径:os.path.realpath(__file__)os.path.abspath(__file__)os.getcwd()修改当前的工作目录:os.chdir('~/Desktop/data/')
2021-01-13 09:19:20 381
原创 python标准化输出
例如:a = "我叫:%s,今年%d岁" % ("小明",12)print(a)# 我叫:小明,今年12岁要注意传入的内容依旧是python特有的类型整数类型细节%o八进制%d十进制%x十六进制浮点数类型细节%f保留小数点后六位,%0.3f保留小数点后三位%e保留小数点后面六位有效数字,指数形式输出%.3e保留3位小数位,使用科学计数法字符串类型细节%s字符串输出%20s右对齐占
2021-01-12 15:01:59 578
原创 使用py2neo构建neo4j图模型小demo
首先启动neo4j./neo4j console连接数据库from py2neo import Graph, Node, Relationshipgraph = Graph("http://localhost:7474", auth=("neo4j", "maoniou"))# graph.delete_all() # 删除已有的所有内容添加节点node1 = Node('Person', name='Bob')graph.create(node1)node2 = No.
2021-01-12 14:36:50 430
原创 Linux解压tar.gz、zip、tar.bz2 文件与对应的命令
文章目录xxx.tar.gzxxx.zipxxx.tar.bz2xxx.tar.gztar -zxvf xxx.tar.gzxxx.zipunzip xxx.zipxxx.tar.bz2tar -jxvf xxx.tar.bz2
2021-01-12 10:25:37 238
原创 Neo4j配置安装与测试
先安装并配置jdk使用Neo4j,需要先安装java的jdk,同时Neo4j不支持低版本的jdk到网站:https://www.oracle.com/java/technologies/javase-downloads.html,下载新版的jdk,安装并配置环境变量即可验证一下,如果能合理显示版本,表示配置成功:java -vjavac -v安装配置Neo4j进入网站:https://neo4j.com/download-center/#community,下载neo4j的社区版:win
2021-01-12 09:11:35 985 1
原创 Graft货币(GRFT)结点搭建
Graft官网:https://www.graft.network/github地址:https://github.com/graft-project/GraftNetwork/releases节点搭建从https://github.com/graft-project/GraftNetwork/releases/tag/v1.9.2获得安装结点,使用如下代码:sudo apt install libnorm-devwget https://github.com/graft-project/Graf
2021-01-11 17:22:07 555
原创 Lethean结点搭建
文章目录结点搭建日志位置Lethean官网:https://github.com/LetheanMovement/letheangithub地址:https://github.com/LetheanMovement/lethean结点搭建wget https://github.com/LetheanMovement/lethean/releases/download/v3.1.0/lethean-cli-linux-64bit-v3.1.tar.bz2tar -jxvf lethean-cli-l
2021-01-10 18:07:50 166
原创 Bytecoin节点搭建
Bytecoin官网网址:https://bytecoin.org/downloadsBytecoin github地址:https://github.com/bcndev/bytecoin首先安装依赖sudo apt-get install unzip然后安装:wget https://github.com/bcndev/bytecoin/releases/download/v3.5.1/bytecoin-daemons-3.5.1-linux64.zipunzip bytecoin-dae
2021-01-08 21:39:16 228
原创 解决Mac装上Jetbrain系列软件(Pycharm/Idea)破解包无效导致软件启动报错
解决方法如果是pycharm 2020.3版本,使用:rm -rf ~/Library/Application Support/JetBrains/PyCharm2020.3如果是idea或是其他版本,只需要删除~/Library/Application Support/JetBrains目录下对应的配置即可问题解析打开软件后会有下面的报错信息:Process: pycharm [74901]Path: /Applications
2021-01-08 09:20:39 1525 2
使用pyLDAvis的实例结果,及d3.min.js,ldavis.v1.0.0.css,ldavis.v1.0.0.js
2022-02-26
handless_firefox.tar
2020-12-26
一键安装libpcap及其所有依赖文件的脚本
2017-11-26
W3Cschool参考手册资料
2017-04-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人