摘要: 1 import pandas as pd 2 import numpy as np 3 4 df = pd.DataFrame({ 5 'key1': [4, 5, 3, np.nan, 2], 6 'key2': [1, 2, np.nan, 4, 5], 7 'key3': [1, 2, 3, 阅读全文
posted @ 2019-04-29 21:29 xsan 阅读(1973) 评论(0) 推荐(0)
摘要: 1 /** 2 * 使用循环的方式判断一个元素是否存在于一个数组中 3 * @param {Object} arr 数组 4 * @param {Object} value 元素值 5 */ 6 function isInArray(arr,value){ 7 for(var i = 0; i < arr.length; i++){ 8 if(va... 阅读全文
posted @ 2019-04-20 14:48 xsan 阅读(3311) 评论(0) 推荐(0)
摘要: import pandas as pd import numpy as np import names ''' 写在前面的话: 1、series与array类型的不同之处为series有索引,而另一个没有;series中的数据必须是一维的,而array类型不一定 2、可以把series看成一个定长的 阅读全文
posted @ 2019-01-18 20:30 xsan 阅读(9671) 评论(0) 推荐(0)
摘要: 1 import numpy as np 2 3 # 1、快速排序 4 ''' 5 1、np.sort(),不改变原先值的顺序,但是在运行时占内存 6 2、ndarry.sort(),改变原先值的顺序,不占用内存 7 ''' 8 # 不改变n1的顺序 9 n1 = np.array([2, 5, 8, 156, 4, 9, 3]) 10 n2 = np.sort(n1) 11... 阅读全文
posted @ 2019-01-16 20:37 xsan 阅读(1329) 评论(0) 推荐(0)
摘要: 全选 共选中0条 阅读全文
posted @ 2019-01-07 09:44 xsan 阅读(675) 评论(0) 推荐(1)
摘要: 全选 阅读全文
posted @ 2019-01-06 11:04 xsan 阅读(2512) 评论(0) 推荐(1)
摘要: function change_style() { $.ajax({ url: "{% url 'change_style' %}", type: "GET", dataType: 'json', data: {'product_category':$('select.product_categor 阅读全文
posted @ 2018-12-20 13:40 xsan 阅读(1464) 评论(0) 推荐(0)
摘要: 如果是提交表单时,可以通过$('#update_form').serialize(),直接打包提交。 阅读全文
posted @ 2018-12-20 10:06 xsan 阅读(14122) 评论(0) 推荐(1)
摘要: 删除 阅读全文
posted @ 2018-12-20 09:46 xsan 阅读(244) 评论(0) 推荐(0)
摘要: var str=new String(); var arr=new Array(); str="ddd,dsd,3,dd,g,k"; //可以用字符或字符串分割 arr=str.split(','); for(var i=0;i<arr.length;i++) { alert(arr[i]); } 阅读全文
posted @ 2018-12-11 19:41 xsan 阅读(916) 评论(0) 推荐(0)
摘要: 1、 去掉字符串前后所有空格: 代码如下: function Trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } 阅读全文
posted @ 2018-12-11 19:39 xsan 阅读(407) 评论(0) 推荐(0)
摘要: 1 import numpy as np 2 3 ######################## 4 # 索引 5 n1 = np.random.randint(0, 100, 10) 6 # print(n1) 7 ''' 8 [68 27 40 11 18 6 61 62 67 31] 9 ''' 10 # print(n1[5]) 11 '''... 阅读全文
posted @ 2018-11-30 21:17 xsan 阅读(345) 评论(0) 推荐(0)
摘要: 1 import numpy as np 2 3 # 创建 4 # 创建一维数组 5 a = np.array([1, 2, 3]) 6 print(a) 7 ''' 8 [1 2 3] 9 ''' 10 # 创建多维数组 11 b = np.array([(1, 2, 3), (4, 5, 6)]) 12 print(b) 13 ''' 14 [... 阅读全文
posted @ 2018-10-28 17:07 xsan 阅读(2895) 评论(0) 推荐(0)
摘要: 注意: 1、 关闭输入框的历史记录功能 ,autocomplete="off"。否则会将用户的输入历史记录也显示出来。 2、datalist标签的id要与input标签的list属性的值一致。 3、动态获取input的输入值,给input标签绑定“keyup”事件。 4、本实例使用了jQuery和b 阅读全文
posted @ 2018-10-08 11:25 xsan 阅读(7099) 评论(0) 推荐(0)
摘要: django下载Excel,使用django-excel插件 由于目前的资料多是使用pandas或xlwt库实现的。其实没有那么的麻烦,因为django有相对应的插件django-excel。 该插件是依赖于pyexcel库写的。不过,不用专门安装pyexcel库,因为在安装django-excel 阅读全文
posted @ 2018-09-30 08:58 xsan 阅读(4720) 评论(0) 推荐(0)
摘要: django操作多数据库 1、 添加数据库路由分配文件 在项目文件夹里创建‘database_router’文件。将下面的代码复制到该文件里。 2、在settings.py文件中配置多数据库 #设置数据库路由,将django_test改为你项目的名称。 DATABASE_ROUTERS = ['dj 阅读全文
posted @ 2018-09-15 18:33 xsan 阅读(847) 评论(0) 推荐(0)
摘要: 加载并全屏轮播加载的其他网站的页面 一、 设计思路 1、使用iframe标签加载其他网站页面 2、通过js替换iframe的加载链接 3、通过js的定时器实现轮播 4、通过js实现全屏 二、代码小解 1、加载页面 <iframe src="https://www.baidu.com" width=' 阅读全文
posted @ 2018-09-02 13:47 xsan 阅读(1001) 评论(0) 推荐(0)
摘要: 方式一:from django.views.decorators.csrf import csrf_exemptfrom django.utils.decorators import method_decoratorfrom django.views import Viewclass Goods_v 阅读全文
posted @ 2018-08-31 17:21 xsan 阅读(748) 评论(0) 推荐(0)
摘要: 解决django配合nginx部署后admin样式丢失 1、 在项目的settings.py文件里添加以下内容: STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] STATIC_ROOT = 阅读全文
posted @ 2018-08-15 16:36 xsan 阅读(903) 评论(0) 推荐(0)
摘要: Centos7安装anaconda3 1、 安装bunzip2 yum install bunzip2 2、 下载anaconda3 wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh 3、 安装anacond 阅读全文
posted @ 2018-07-30 19:02 xsan 阅读(353) 评论(0) 推荐(0)