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 小小喽啰 阅读(17310) 评论(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 小小喽啰 阅读(698) 评论(0) 推荐(0) 编辑