๐Ÿ“Š[DataCamp] Counting, Grouped summary statistics : groupby(), Pivot tables

2020. 9. 5. 22:28ใ†Learning archive/Data Science

๐Ÿ“Œ drop_duplicate method 

Removing duplicates is an essential skill to get accurate counts, because often you don't want to count the same thing multiple times. 

//์ค‘๋ณต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ๋ฉ”์„œ๋“œ 

๐Ÿ“ŒCounting categorical variables

Counting is a great way to get an overview of your data and to spot curiosities that you might not notice otherwise.

 

 

.value_counts()

.value_counts(normalize=True) 

// To calculate proportions, set normalize to True in .value_counts(). 

 

๐Ÿ“ŒGrouped summary statistics

_ compare different groups 

 

 

 

 

that's too much work

 

.groupby("")[""].mean()

to get multiple statistics, use agg

 

 

 

 

 

many groups, many summaries 

 

๐Ÿ“Œ๊ทธ๋ฃจํ•‘ํ•˜๊ณ , ์ปฌ๋Ÿผ ์ง€์ •ํ•˜๊ณ , Calculate

 

 

๐Ÿ“Œpivot tables : calculating group summary statistics 

 

 

 

 

NAN --> 0