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 |
Tags
- 딥러닝
- convex optimization
- machine learning
- neural network
- Jacobian Matrix
- Series
- David Silver
- 논문
- 판다스
- 유니티
- 사이킷런
- Laplacian
- ML-Agent
- statistics
- Deep Learning
- optimization
- 데이터 분석
- list
- rl
- 모두를 위한 RL
- 강화학습
- pandas
- unity
- Hessian Matrix
- paper
- reinforcement learning
- 김성훈 교수님
- Linear algebra
- 리스트
- Python Programming
Archives
RL Researcher
05. 판다스(Pandas) - Series 값 변경, Slicing 본문
1. Series 값 변경
-
추가 및 업데이트: 인덱스를 이용
-
삭제: drop함수 이용
s = pd.Series(np.arange(100, 105), ['a', 'b', 'c', 'd', 'e'])
s
========================================================================
<output>
a 100
b 101
c 102
d 103
e 104
dtype: int64
s['a'] = 200
s
========================================================================
<output>
a 200
b 101
c 102
d 103
e 104
dtype: int64
s['k'] = 300
s
========================================================================
<output>
a 200
b 101
c 102
d 103
e 104
k 300
dtype: int64
s.drop('k', inplace=True) # inplace = True : 원본에다 변경을 하겠다는 뜻
s
========================================================================
<output>
a 200
b 101
c 102
d 103
e 104
dtype: int64
s[['a', 'b']] = [300, 900]
s
========================================================================
<output>
a 300
b 900
c 102
d 103
e 104
dtype: int64
2. Series Slicing
-
리스트, ndarray와 동일하게 적용
s1 = pd.Series(np.arange(100, 105))
s1
========================================================================
<output>
0 100
1 101
2 102
3 103
4 104
dtype: int64
s2 = pd.Series(np.arange(100, 105), ['a', 'c', 'b', 'd', 'e'])
s2
========================================================================
<output>
a 100
c 101
b 102
d 103
e 104
dtype: int64
s1[1:3]
========================================================================
<output>
1 101
2 102
dtype: int64
s2[1:3]
========================================================================
<output>
c 101
b 102
dtype: int64
s2['c':'d']
========================================================================
<output>
c 101
b 102
d 103
dtype: int64
'AI Basic > Pandas' 카테고리의 다른 글
07. 판다스(Pandas) - DataFrame 구조 (0) | 2021.01.04 |
---|---|
06. 판다스(Pandas) - DataFrame (0) | 2021.01.04 |
04. 판다스(Pandas) - Series boolean selection 활용 (0) | 2021.01.03 |
03.판다스(Pandas) - Series 데이터 연산 (0) | 2021.01.03 |
02. 판다스(Pandas) - 개수, 빈도 등 계산하기 (0) | 2021.01.03 |
Comments