DTS: Missing Value detection(02)
♠ Ref.01
note를 public으로 올려는 놨는데 검색이 될까 모르겠네요.
Missing Value : 결측치 확인
data Loading
1 | import pandas as pd |

data info
1 | covidtotals.info() |

data division
- 인구통계 관련 column
- Covid 관련 column
1 | case_vars = ["location", "total_cases", "total_deaths", "total_cases_pm", "total_deaths_pm"] |
demo_vars column별로 결측치를 측정
1 | covidtotals[demo_vars].isnull().sum(axis = 0) # column별로 결측치를 측정 |

case_vars column별로 결측치를 측정
1 | covidtotals[case_vars].isnull().sum(axis = 0) # column별로 결측치를 측정 |

- case_vars 에는 결측치가 없지만, demo_vars에는 결측치가 있는 것을 확인 할 수 있다.
| pop_density | 12 | |||
| median_age | 24 | |||
| gdp_per_capita | 28 | |||
| hosp_beds | 46 |
위의 column들에 각각 수만큼의 결측치를 확인 할 수 있다.
행 방향으로 발생한 결측치 확인
1 | demovars_misscnt = covidtotals[demo_vars].isnull().sum(axis = 1) |
0 156
1 24
2 12
3 10
4 8
dtype: int64
1 | covidtotals[case_vars].isnull().sum(axis = 1).value_counts() |
0 210
dtype: int64
인구통계 데이터가 3가지 이상 누락된 국가를 나열하기
1 | ["location"] + demo_vars |

case에는 누락국가가 없지만, 그냥 한번 확인
1 | casevars_misscnt = covidtotals[case_vars].isnull().sum(axis = 1) |
0 210
dtype: int64
1 | covidtotals[covidtotals['location'] == "Hong Kong"] |
1 | temp = covidtotals.copy() |

이건 잘 모르겠다. 그냥 삭제 할 수 있다.
DTS: Missing Value detection(02)
https://yoonhwa-p.github.io/2021/12/22/python/DTS_MissingValue2/
You need to set
install_url to use ShareThis. Please set it in _config.yml.