[Pandas] 데이터 전처리 (3)
df.drop() : 행과 열 삭제 import pandas as pd data_dict = { 'Name' : ['John', 'Sabre', 'Kim', 'Sato', 'Lee', 'Smith', 'David'], 'Country' : ['USA', 'France', 'Korea', 'Japan', 'Korea', 'USA', 'USA'], 'Age' : [31, 33, 28, 40, 36, 55, 48], 'Job' : ['Student', 'Lawyer', 'Developer', 'Chef', 'Professor', 'CEO', 'Banker'] } df = pd.DataFrame(data_dict) df = df.drop(1, axis=0) df df = df.drop([3, 5], axis =..
2022. 7. 24.
[Pandas] 데이터 전처리 (1)
데이터프레임 (Dataframe) 데이터프레임은 dictionary 데이터 또는 list 데이터를 이용해서 생성할 수 있다. import pandas as pd data_dict = { 'Name' : ['John', 'Sabre', 'Kim', 'Sato', 'Lee', 'Smith', 'David'], 'Country' : ['USA', 'France', 'Korea', 'Japan', 'Korea', 'USA', 'USA'], 'Age' : [31, 33, 28, 40, 36, 55, 48], 'Job' : ['Student', 'Lawyer', 'Developer', 'Chef', 'Professor', 'CEO', 'Banker'] } df = pd.DataFrame(data_dict) impo..
2022. 7. 23.