本文共 536 字,大约阅读时间需要 1 分钟。
map:对指定序列做映射
python3中的:
map(function, iterable, ...)
map(lambda x, y: x + y, [1, 3, 5, 7, 9], [2, 4, 6, 8, 10])
lambda 形参:返回值 实参
再如:
a = {'1': ['88.12', '28100', '23'], '8': ['88.05', '2400', '3']} 把里面元素的转化成适当的数字
a = dict(map(lambda x:( int(x[0]), [float(x[1][0]), int(x[1][1]), int(x[1][2])]) ,a.items()))
pandas中:
result["datetime"] = [convert_date_to_date_int(pd.to_datetime(str(dt))) for dt in data.index.values]
转载地址:http://jgfkz.baihongyu.com/