2020年9月30日

set()函数

摘要: set() 函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。 set 语法: class set([iterable]) 参数说明: iterable -- 可迭代对象对象; 以下实例展示了 set 的使用方法: >>>x = set('runoob') > 阅读全文

posted @ 2020-09-30 16:36 Mint-Tremor 阅读(31) 评论(0) 推荐(0) 编辑

jupyter notebook多行注释方法

摘要: 多行注释的方法百度到的大部分是错的,Ctrl+\是pycharm等IDE内的使用方法,而不是jupyter中的,正确的方法如下: 按住alt后光标变为十字形,沿着行标向下拖,光标变得很长,这时shift+3使用#注释多行 想要取消注释时也是同样,拉出长光标后用→把光标置于#右侧,然后删除 阅读全文

posted @ 2020-09-30 10:53 Mint-Tremor 阅读(952) 评论(0) 推荐(0) 编辑

lambda函数

摘要: lambda是Python预留的关键字 lambda函数的特性: 1.lambda函数是匿名的:所谓匿名函数,通俗地说就是没有名字的函数。lambda函数没有名字。 2.lambda函数有输入和输出:输入是传入到参数列表argument_list的值,输出是根据表达式expression计算得到的值 阅读全文

posted @ 2020-09-30 10:34 Mint-Tremor 阅读(326) 评论(0) 推荐(0) 编辑

astype()函数

摘要: astype()函数可用于转化dateframe某一列的数据类型 如下将dateframe某列的str类型转为int,注意astype()没有replace=True的用法,想要在原数据上修改,要写成如下形式。 app_train[['uid','index']] = app_train[['uid 阅读全文

posted @ 2020-09-30 09:15 Mint-Tremor 阅读(118) 评论(0) 推荐(0) 编辑

2020年9月29日

python库之networkx之创建有向图的方法

摘要: import networkx as nx import matplotlib.pyplot as plt textline = '1 2 3' fh = open('test.edgelist','w') d = fh.write(textline) fh.close() G = nx.read_ 阅读全文

posted @ 2020-09-29 22:27 Mint-Tremor 阅读(1120) 评论(0) 推荐(0) 编辑

2018年6月11日

查找数据是否存在

摘要: #include<stdio.h>#include<stdlib.h>#include<time.h> void main(){ time_t ts; srand((unsigned int)time(&ts)); int a[10]; for (int i = 0; i < 10; i++) { 阅读全文

posted @ 2018-06-11 22:56 Mint-Tremor 阅读(79) 评论(0) 推荐(0) 编辑

随机生成数

摘要: #include<stdio.h>#include<stdlib.h>#include<time.h> void main(){ time_t ts; srand((unsigned int)time(&ts)); int a[10]; for (int i = 0; i < 10; i++) { 阅读全文

posted @ 2018-06-11 22:48 Mint-Tremor 阅读(81) 评论(0) 推荐(0) 编辑

一维数组

摘要: #include<stdio.h>#include<stdlib.h> void main1(){ int a[10]; printf("%d",sizeof(a)); for (int i = 9; i > -1; i--) { a[i] = i; printf("\n%d,%x",a[i],&a 阅读全文

posted @ 2018-06-11 22:47 Mint-Tremor 阅读(100) 评论(0) 推荐(0) 编辑

2018年6月1日

正三角形外接圆面积

摘要: #include<stdio.h>#include<stdlib.h> int main(){ int n; float pi = 3.1415926; scanf("%d", &n); while (n--) { float m; scanf("%f", &m); float S = pi*m*m 阅读全文

posted @ 2018-06-01 17:44 Mint-Tremor 阅读(284) 评论(0) 推荐(0) 编辑

2018年5月31日

递归加法运算

摘要: #include<stdio.h>#include<stdlib.h> int go(int n){ if (n == 1) { return 1; } else { return go(n - 1) + n;//递归运算 }} void main(){ printf("%d", go(100)); 阅读全文

posted @ 2018-05-31 22:55 Mint-Tremor 阅读(474) 评论(0) 推荐(0) 编辑

导航