上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 39 下一页
  2020年11月13日
摘要: 有时我们需要这样的dict,key来自于一个list,value来自一个list,比如说df重新命名时,需要以字典传入时,下面介绍一下怎么使用 b=[1,2,3,4,5,6] a=list('abcd') dict(zip(a,b)) #{'a': 1, 'b': 2, 'c': 3, 'd': 4 阅读全文
posted @ 2020-11-13 14:21 小小喽啰 阅读(292) 评论(0) 推荐(0)
  2020年11月12日
摘要: 一、安装 一个库「Bar Chart Race」,堪称Python界最强的动态可视化包。 GitHub地址:https://github.com/dexplo/bar_chart_race 文档地址:https://www.dexplo.org/bar_chart_race/ 目前主要有0.1和0. 阅读全文
posted @ 2020-11-12 09:31 小小喽啰 阅读(4737) 评论(0) 推荐(0)
  2020年11月9日
摘要: 首先,我们看看下面的df的字段的例子 很多时候,我们需要其中的数字,而文字对我们没有多大的作用,这时候需要我们去处理 import re # 方式1:通过自定义的函数,传给apply方法 def apply_size(x): return x.split("面积")[1].split("㎡")[0] 阅读全文
posted @ 2020-11-09 19:44 小小喽啰 阅读(292) 评论(0) 推荐(0)
  2020年11月6日
摘要: 一般来说,要使用某个类的方法,需要先实例化一个对象再调用方法。而使用@staticmethod或@classmethod,就可以不需要实例化,直接类名.方法名()来调用。这有利于组织代码,把某些应该属于某个类的函数给放到那个类里去,同时有利于命名空间的整洁。 既然@staticmethod和@cla 阅读全文
posted @ 2020-11-06 14:25 小小喽啰 阅读(2742) 评论(0) 推荐(0)
摘要: 比如说,前【2,5】列分别是每个学科的成绩,第1列是学号,我们找出每个学生的最高分的学科,则可以如下表达 def find_max(df): x = df.col1 y = df.col2 z = df.col3 n = df.col4 if min(x,y,z,n) == x: tmp = '数学 阅读全文
posted @ 2020-11-06 10:41 小小喽啰 阅读(796) 评论(0) 推荐(0)
摘要: 此方法多用以复合索引的切片搜索 函数如下 df.index.get_level_values(lever) lever:int or str,索引位置或者是索引的名称 例子 import pandas as pd tuples = [('A','a'),('A','b'),('B','a'),('B 阅读全文
posted @ 2020-11-06 10:02 小小喽啰 阅读(2622) 评论(0) 推荐(0)
  2020年11月5日
摘要: 很多时候我们需要在任意处添加一列,而非末尾添加一列,下面就介绍一下几种方法 1.df.insert但是这个允许插入一列 one_hot.insert(0,'reportno',value=data_due_merge_cate['reportno']) DataFrame.insert(loc,co 阅读全文
posted @ 2020-11-05 10:47 小小喽啰 阅读(17994) 评论(0) 推荐(0)
摘要: 一、创建多级索引 1、通过pd.MultiIndex.from_tuple或from_arrays 1.1直接从元组列表创建多重索引 tuples = [('A','a'),('A','b'),('B','a'),('B','b')] mul_index = pd.MultiIndex.from_t 阅读全文
posted @ 2020-11-05 10:09 小小喽啰 阅读(768) 评论(0) 推荐(0)
  2020年11月4日
摘要: 目录 Part 1. 生成样本Part 2. 计算AUC、KS、GINIPart 3. PSIPart 4. 分数分布Part 5. 完整工程代码 正文 在我们开发完信用分模型后,经常需要计算如下的一些指标: ● 区分度的指标: ○ AUC ○ KS ○ GINI ● 稳定性的指标: ○ PSI ● 阅读全文
posted @ 2020-11-04 10:03 小小喽啰 阅读(2346) 评论(0) 推荐(0)
摘要: 可实现除法 函数参数 DataFrame.div(other, axis='columns', level=None, fill_value=None) 参数 other:标量,序列,系列或DataFrame axis:{0 or ‘index’, 1 or ‘columns’},也就是按行除还是按 阅读全文
posted @ 2020-11-04 09:18 小小喽啰 阅读(1005) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 39 下一页