from functools import reduce
# filter过滤函数
list1 = list(filter(lambda x: x > 100, [-5, 200, 300, 10, 19999]))
# map函数数据转换
list2 = list(map(lambda x: x**2, [11, 22, 33, 44, 55]))
# reduce数据聚合
def doSum(x1,x2):
return x1+x2
x = reduce(doSum,[100,122,232,1213,1231])
print(list1, list2,x)
#数据帧的用法
import pandas as pd
df=pd.DataFrame([
['1','wangtan',32,True],
['2','penny',34,False],
['3','steven',40,True]
])
df.columns=['id','name','age','decision']
print(df)
print(df[['name','age']])
print(df.iloc[:,3])
print(df.iloc[1:3,:])