Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 사이킷런
- Laplacian
- David Silver
- list
- pandas
- Hessian Matrix
- Deep Learning
- Series
- 유니티
- optimization
- 김성훈 교수님
- Python Programming
- 판다스
- ML-Agent
- statistics
- paper
- reinforcement learning
- unity
- rl
- machine learning
- neural network
- 딥러닝
- 강화학습
- 모두를 위한 RL
- Jacobian Matrix
- 논문
- Linear algebra
- 데이터 분석
- convex optimization
- 리스트
Archives
RL Researcher
04. 판다스(Pandas) - Series boolean selection 활용 본문
1. Boolean selection
-
boolean Series가 []와 함께 사용되면 True 값에 해당하는 값만 새로 반환되는 Series객체에 포함됨
-
다중조건의 경우, &(and), |(or)를 사용하여 연결 가능
s = pd.Series(np.arange(10), np.arange(10)+1)
s
========================================================================
<output>
1 0
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
dtype: int64
s > 5
========================================================================
<output>
1 False
2 False
3 False
4 False
5 False
6 False
7 True
8 True
9 True
10 True
dtype: bool
s[s>5]
========================================================================
<output>
7 6
8 7
9 8
10 9
dtype: int64
s[s % 2 == 0]
========================================================================
<output>
1 0
3 2
5 4
7 6
9 8
dtype: int64
s.index > 5
========================================================================
<output>
array([False, False, False, False, False, True, True, True, True,
True])
s[s.index > 5]
========================================================================
<output>
6 5
7 6
8 7
9 8
10 9
dtype: int64
s[(s > 5) & (s < 8)]
========================================================================
<output>
7 6
8 7
dtype: int64
(s >= 7).sum()
========================================================================
<output>
3
(s[s>=7]).sum()
========================================================================
<output>
24
'AI Basic > Pandas' 카테고리의 다른 글
06. 판다스(Pandas) - DataFrame (0) | 2021.01.04 |
---|---|
05. 판다스(Pandas) - Series 값 변경, Slicing (0) | 2021.01.04 |
03.판다스(Pandas) - Series 데이터 연산 (0) | 2021.01.03 |
02. 판다스(Pandas) - 개수, 빈도 등 계산하기 (0) | 2021.01.03 |
01. 판다스(Pandas) - Index, value 활용 (0) | 2021.01.03 |
Comments