목록Merge (1)
호기심 많은 분석가

우리는 보통 DataFrame을 merge할 때 pandas의 merge를 쓰곤한다. 하지만 Series에는 merge가 적용되지 않는 다! 그래서 pd.concat을 이용하곤 하는데, Series의 내장 함수인 combine을 사용해보자. 위와 같은 10-16시까지의 값들만 존재하는 Series가 있다. 이 데이터를 24시간으로 시각화 시키기 위해 나머지 HOUR에는 0을 넣으려고 한다. 이때 어떻게 해줄 수 있을까? 우선 0-24시까지 0뿐인 Series를 생성해준다. zero_series = pd.Series(index=range(24), data=[0]*24) zero_series 이제 우리는 두 Series를 combine을 통해 합쳐줄 거다. Series1.combine(Series2, max..
Coding/Machine Learning & Python
2021. 7. 5. 23:27