Python과 머신러닝/최종 실습 (Titanic Dataset)(2)
-
[Python.TitanicOverview] 데이터 전처리 2 - 결측치 처리
1. 결측치 처리 예제 In [1]:import pandas as pd import numpy as np In [2]:#https://chrisalbon.com/python/data_wrangling/pandas_missing_data/ raw_data = {'first_name': ['Jason', np.nan, 'Tina', 'Jake', 'Amy'], 'last_name': ['Miller', np.nan, 'Ali', 'Milner', 'Cooze'], 'age': [42, np.nan, 36, 24, 73], 'sex': ['m', np.nan, 'f', 'm', 'f'], 'preTestScore': [4, np.nan, np.nan, 2, 3], 'postTestScore': [25, np...
2021.02.26 -
[Python.TitanicOverview] 데이터 입력 및 전처리
1. 데이터 입력 In [1]:import pandas as pd import os import matplotlib.pyplot as plt import numpy as np import seaborn as sns In [2]:sns.set(style='white') #white background style for seaborn plots sns.set(style='whitegrid', color_codes=True) In [3]:DATA_DIR='titanic' os.listdir(DATA_DIR) Out[3]:['test.csv', 'train.csv'] In [4]:data_files = reversed([os.path.join(DATA_DIR, filename) for filename in os..
2021.02.25