Note
Pandas (18) 본문
728x90
How to convert the first character of each element in a series to uppercase?
# Input
ser = pd.Series(['how', 'to', 'kick', 'ass?'])
# 1
ser.map(lambda x: x.title())
# 2
ser.map(lambda x: x[0].upper() + x[1:])
# 3
pd.Series([i.title() for i in ser])
# output
0 How
1 To
2 Kick
3 Ass?
dtype: object
'Pandas' 카테고리의 다른 글
Pandas (20) (0) | 2022.08.11 |
---|---|
Pandas (19) (0) | 2022.08.10 |
Pandas (17) (0) | 2022.08.08 |
Pandas (16) (0) | 2022.08.07 |
Pandas (15) (0) | 2022.08.06 |
Comments