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 |
Tags
- 데이터 분석
- 사이킷런
- paper
- convex optimization
- 리스트
- ML-Agent
- Python Programming
- unity
- 판다스
- Laplacian
- Series
- 딥러닝
- Linear algebra
- neural network
- 논문
- Deep Learning
- 유니티
- 강화학습
- David Silver
- Hessian Matrix
- statistics
- optimization
- 김성훈 교수님
- 모두를 위한 RL
- pandas
- reinforcement learning
- rl
- list
- machine learning
- Jacobian Matrix
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