python

python basics

#list comprehension

#enumerate

Iterable: member를 하나씩 차례로 반환가능한 object

  • 대표적으로 list, str, tuple있음
  • zip(), map()등 함수 활용가능

transform, fillna


# 
train_x = train_x[idx_list + un_list + n_list].transform(lambda x:(x–x.mean()/x.std).fillna(0.0))

memcodes

pd.concat([chunk.iloc[0] for chunk in df])

[i for i in j for j in if i+j %2 ==0]

[i + j for i in range(10) for j in range(10) if (i + j) % 2 == 0]

[df.iloc[i].corr(df.iloc[i+1]) for i in range(df.shape[0])[:-1]]

df = pd.read_pickle('CV_results.pkl')

df.sort_values('error')