![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
编程知识
涉及编程。
猫咪钓鱼
相信美好的一切,批判所有的邪恶。
展开
-
python中.append()和.extend()的区别
话不多说,直接上例子:>>>a = [1,2]>>>b = [3,3]>>>a.append(b)>>>aOut[62]: [1, 2, [3, 3]]>>>a.extend(b)>>>aOut[64]: [1, 2, [3, 3], 3, 3]原创 2020-12-03 17:07:28 · 154 阅读 · 0 评论 -
python列表中 [ :: ]的用法
话不多说,直接用最直观的例子解释:a = [0,1,2,3,4,5] # 初始列表In: a[0::1]Out: [0, 1, 2, 3, 4, 5]In: a[0::2]Out: [0, 2, 4]In: a[1::2]Out: [1, 3, 5]可以看到,a[0::1] 表示从下标 为 0 的元素开始取数,步长为 1,所以往后逐个取数,取数分别为 0 1 2 3 4 5 ....原创 2020-09-26 15:28:22 · 3584 阅读 · 0 评论 -
numpy中的.npy和.npz到底为何物?
A simple format for saving numpy arrays to disk with the full information about them.The .npy format is the standard binary file format in NumPy for persisting a single arbitrary NumPy array on disk....原创 2020-04-25 21:45:59 · 1765 阅读 · 1 评论 -
python之turtle库(画图)
这篇文章主要介绍了使用Python的turtle模块画图的方法,涉及turtle简介,运动命令,画笔控制命令的分享,以及具体操作的步骤,具有一定参考价值,需要的朋友可以了解下。原创 2020-02-06 21:16:33 · 2322 阅读 · 0 评论 -
malloc与new的区别
malloc与new的不同点malloc 和 new 至少有五点(博主已知)不同 一new 返回指定类型的指针,并且可以自动计算所需要大小。比如:int *p;p = new int; //返回类型为int* 类型(整数型指针),分配大小为 sizeof(int);或:int* parr;parr = new int [100]; //返回类型为 int* 类型(整数型指针...原创 2019-12-23 11:02:29 · 117 阅读 · 0 评论 -
Python函数——.strip()
讲述函数.strip()的使用方法。博主在查阅此函数的使用方法时,未找到当.stip()参数为空时其作用的例子,故自己测试了一次,现记录下来:现做个总结:.strip()参数为空时,其作用是去除字符串首尾的所有空格。代码:a = 'abcd' b = 'abcd ' # 后有3个空格c = ' abcd ' # 前有2个空格,后有3个空格print('...原创 2020-03-04 20:37:23 · 666 阅读 · 0 评论 -
合并DateFrame之—— append()
请看例子:可以看到,当使用函数append()处理两个DataFrame时,会分别保留原来的index,并且时上下接合的。原创 2019-07-31 10:24:14 · 496 阅读 · 4 评论 -
如何给DataFrame的列命名或重命名。
原文链接转载自简书 夜雨寒山简介: 本文主要介绍怎样为DataFrame的columns重命名。部分重命名columns = dict,使用字典类型的数据对列进行重命名。 dataframe.rename(columns = {"old_name": "new_name"})dataframe.rename(columns = {"old1": "new1", "old2":"n...原创 2019-07-27 21:08:58 · 30163 阅读 · 4 评论 -
.compute() 函数
在看一个机器学习项目的源码时,看到有一个.compute()函数,结果到处都找不到它的用法,不过最后还是在Dask官网里找到了。下面是英文的文档,各位可以就着百度翻译查看。compute(**kwargs)Compute this dask collectionThis turns a lazy Dask collection into its in-memory equivalen...原创 2019-07-28 20:35:30 · 11513 阅读 · 0 评论 -
DAE(去噪自动编码器)
原文链接转载 2019-08-14 10:51:54 · 3898 阅读 · 0 评论 -
在tensorflow中的网格图问题--np.mgrid()
原创 2019-08-17 13:33:22 · 449 阅读 · 0 评论 -
pandas 中的函数—— .reset_index()
话不多说,直接上例子:原创 2019-07-31 09:52:02 · 23448 阅读 · 1 评论 -
pandas中的函数—— .map()
pandas中函数千千万,这次讲讲 .map()英文文档链接原创 2019-07-30 21:50:33 · 21824 阅读 · 0 评论 -
通过迭代在DataFrame中取出满足某种条件的列,函数 —— .columns
举一个例子展示,其他用法可以类推:binary_variables = [c for c in train.columns if train[c].nunique() == 2]除此之外,说明一下 .colomns :原创 2019-07-30 15:36:42 · 1420 阅读 · 0 评论 -
python的.arsort()函数的用法
简单总结一下argsort()函数的用法,直接上例子:from numpy import *a = [-2,0,3,-4]print(argsort(a))输出:[3 0 1 2]从小到大排列为:-4(第3个数),-2(第0个数),0(第1个数),3(第2个数),故输出为3012作者:泡泡360链接:https://www.jianshu.com/p/5dee4f6ded48...原创 2019-07-28 11:05:57 · 353 阅读 · 0 评论 -
LGB + KFold 代码 (1)
来自Kaggle的一个比赛。原网址链接原创 2019-07-29 11:19:19 · 1107 阅读 · 0 评论 -
.zip() 函数
.zip()描述用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。注意:zip 方法在 Python 2 和 Python 3 中的不同:在 Python 3.x 中为了减少内存,zip() 返回的是一个对象。如需展示列表,需手动 list() 转换。*用法>>>a = [1,2,3]>>> b =...原创 2019-07-29 21:18:14 · 168 阅读 · 0 评论 -
python中 .sort()、 sorted()和 .reverse() 、reversed()的区别
原文链接转载 2019-07-29 21:29:17 · 4068 阅读 · 0 评论 -
python常见可视化图像及实现代码
收集平时遇到的python可视化代码和图像sns.pairplot()参数:size : 确定图像的长宽并以正方形显示 aspect : 取值在0~1之间,aspect与图像高的成绩代表图像的宽度sns.pairplot(data, x_vars=['TV','radio','newspaper'], y_vars='sales', size=7, aspect=0.7, k...原创 2019-07-30 09:37:00 · 2710 阅读 · 0 评论 -
python函数—— .items()
话不多说,直接上例子:a = {'first':'hello','second':'world'}a.items()dict_items([(‘first’, ‘hello’), (‘second’, ‘world’)])type(a)dicttype(a.items())dict_itemsfor a,b in a.items(): print (a)...原创 2019-07-30 15:17:11 · 16231 阅读 · 0 评论 -
LGB 的 .feature_importance() 函数
对于机器学习训练来说,每一种特征对于机器学习训练的模型的重要性可能是不一样的,此时,这个函数就起到了作用。feature_importance(importance_type='split', iteration=None)Get feature importances.Parameters:importance_type (string, optional (default=“s...原创 2019-07-29 11:30:05 · 11282 阅读 · 0 评论