데이터를 합칠 때 병합이나 이어붙이기로는 불가능한 상황이 있는데, 두 데이터셋의 색인이 일부
겹치거나 전체가 겹치는 경우가 그렇다. 벡터화된
if
-
else
구문을 표현하는
NumPy
의
where
함수로 자세히 알아보자.
In
[
108
]:
a
=
pd
.
Series
([
np
.
nan
,
2
.
5
,
np
.
nan
,
3
.
5
,
4
.
5
,
np
.
nan
],
.....:
index
=
['
f
',
'
e
',
'
d
',
'
c
',
'
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.