上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: 分组后,默认会把分组的那列当作索引,如果不想这列当作索引,就可以添加参数如下,设置分组列不要作为索引: grouby()函数可以按照某列分组,其中分组后的某列连成一个数组 增加新列: https://www.cnpython.com/qa/598149 gg = df.groupby(by=['co 阅读全文
posted @ 2021-12-17 10:56 ivyJ 阅读(603) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-12-16 18:29 ivyJ 阅读(77) 评论(0) 推荐(0)
摘要: 前提是explode的列必须是个list或者数组。如果是字符串数组用这个方法https://www.cnblogs.com/ivyJ/p/15693477.html先转换为数组 方法一: df['gg_type'] = df.apply(lambda x: list(zip(x['GG'],x['G 阅读全文
posted @ 2021-12-16 18:27 ivyJ 阅读(81) 评论(0) 推荐(0)
摘要: @classmethoddef setUpClass(self): self.convert = CptyXVAMeasureConvert() 阅读全文
posted @ 2021-12-15 22:00 ivyJ 阅读(68) 评论(0) 推荐(0)
摘要: import numpy as np required_input = required_input.replace(np.nan, '')query_result_input = query_result_input.replace(np.nan, '')将指定列toy的空值替换成指定值100:d 阅读全文
posted @ 2021-12-15 22:00 ivyJ 阅读(2359) 评论(0) 推荐(0)
摘要: 重置索引后多了一列旧的索引,价格drop=True,把旧的索引列删除 具体可看: https://blog.csdn.net/yasuowjh/article/details/108086687 阅读全文
posted @ 2021-12-15 21:58 ivyJ 阅读(383) 评论(0) 推荐(0)
摘要: 打印dataFrame列的具体数据类型,如果是dtype,无论是string还是数组,dtype打印出来都是object类型,要看到object里的数据类型用type(数值)函数for i in range(15):print(type(df.iloc[0, i])) 阅读全文
posted @ 2021-12-15 21:57 ivyJ 阅读(214) 评论(0) 推荐(0)
摘要: 打印dataFrame简要摘要df.info(verbose=True),允许冗余信息,显示所有信息打印包含用的索引信息,dtype,占用的内存等 https://www.freesion.com/article/58821075401/ 阅读全文
posted @ 2021-12-15 21:55 ivyJ 阅读(523) 评论(0) 推荐(0)
摘要: DataFrame.index values are different (99.99837 %)[left]: RangeIndex(start=0, stop=61525, step=1)[right]: Int64Index([ 0, 0, 0, 0, 0, 1, 1, 1, 1,1,...1 阅读全文
posted @ 2021-12-15 21:46 ivyJ 阅读(447) 评论(0) 推荐(0)
摘要: 1、数组转字符串 #方法1arr = ['a','b']str1 = ''.join(arr)#方法2arr = [1,2,3]#str = ''.join(str(i) for i in arr)#此处str命名与str函数冲突!str2 = ''.join(str(i) for i in arr 阅读全文
posted @ 2021-12-15 21:44 ivyJ 阅读(1310) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 下一页