Skip to Content
파이썬 라이브러리를 활용한 데이터 분석(2판): 영화 평점, 이름 통계, 선거 데이터 등 실사례 사용
book

파이썬 라이브러리를 활용한 데이터 분석(2판): 영화 평점, 이름 통계, 선거 데이터 등 실사례 사용

by 김영근, 웨스 맥키니
June 2019
Beginner to intermediate
664 pages
18h 26m
Korean
Hanbit Media, Inc.
Content preview from 파이썬 라이브러리를 활용한 데이터 분석(2판): 영화 평점, 이름 통계, 선거 데이터 등 실사례 사용
566
파이썬 라이브러리를 활용한 데이터 분석(2판)
In
[
145
]:
lesley
_
like
=
all
_
names
[
all
_
names
.
str
.
lower
().
str
.
contains
('
lesl
')]
In
[
146
]:
lesley
_
like
Out
[
146
]:
632 Leslie
2294 Lesley
4262 Leslee
4728 Lesli
6103 Lesly
dtype
:
object
이제 이 이름들만 걸러내서 이름별로 출생수를 구하고 상대도수를 확인해보자.
In
[
147
]:
filtered
=
top1000
[
top1000
.
name
.
isin
(
lesley
_
like
)]
In
[
148
]:
filtered
.
groupby
('
name
').
births
.
sum
()
Out
[
148
]:
name
Leslee 1082
Lesley 35022
Lesli 929
Leslie 370429
Lesly 10067
Name
:
births
,
dtype
:
int64
그리고 성별과 연도별로 모은 다음 출생연도로 정규화한다.
In
[
149
]:
table
=
filtered
.
pivot
_
table
('
births
',
index
=
'
year
',
.....:
columns
=
'
sex
',
aggfunc
=
'
sum
')
In
[
150
]:
table
=
table
.
div
(
table
.
sum
(
1
),
axis
=
0
)
In
[
151
]:
table
.
tail
()
Out
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.
Start your free trial

You might also like

파이썬 라이브러리를 활용한 머신러닝(번역개정판): 사이킷런 핵심 개발자가 쓴 머신러닝과 데이터 과학 실무서

파이썬 라이브러리를 활용한 머신러닝(번역개정판): 사이킷런 핵심 개발자가 쓴 머신러닝과 데이터 과학 실무서

박해선, 안드레아스 뮐러, 세라 가이도

Publisher Resources

ISBN: 9791162241905