摘要: 1 map()函数的简介以及语法:map是python内置函数,会根据提供的函数对指定的序列做映射。 map()函数的格式是: map(function,iterable,...)第一个参数接受一个函数名,后面的参数接受一个或多个可迭代的序列,返回的是一个集合。 把函数依次作用在list中的每一个元 阅读全文
posted @ 2020-04-10 20:47 zhch0201 阅读(2608) 评论(0) 推荐(0)
摘要: list函数在数据处理中常用于将迭代器或者生成器转化为列表: In [25]: list(range(5))Out[25]: [0, 1, 2, 3, 4] 列表增加元素方式: 1. append方法 n_list.append(new_item) 在列表末尾追加 2. insert方法 n_lis 阅读全文
posted @ 2020-04-10 10:23 zhch0201 阅读(122) 评论(0) 推荐(0)
摘要: 1. 创建: tup = 1, 2, 3 tup = tuple([1, 2, 3]) tup = tuple('abc') 2. 取值,切片: tup[0] tup[:2] tup[2:] tup[:] 3. 生成更长元组: In [3]: (1, 2, 3) + (4, 5)Out[3]: (1 阅读全文
posted @ 2020-04-10 10:08 zhch0201 阅读(146) 评论(0) 推荐(0)
摘要: In [80]: df[:3]Out[80]: time value0 2017-05-20 00:00:00 01 2017-05-20 00:01:00 12 2017-05-20 00:02:00 2 In [81]: df.set_index('time').resample('5min') 阅读全文
posted @ 2020-04-09 16:22 zhch0201 阅读(512) 评论(0) 推荐(0)
摘要: DataFrame.set_index('column') 将列设置为行索引 In [77]: df2[:7]Out[77]: time key value0 2017-05-20 00:00:00 a 0.01 2017-05-20 00:00:00 b 1.02 2017-05-20 00:00 阅读全文
posted @ 2020-04-09 15:53 zhch0201 阅读(3940) 评论(0) 推荐(0)
摘要: df.rename(columns={'原列名':'新列名'},inplace=True) 阅读全文
posted @ 2020-04-09 15:16 zhch0201 阅读(470) 评论(0) 推荐(0)