Pandas drop 예제
Pandas에서 drop을 사용하여 DataFrame의 열 또는 행을 삭제하는 예제입니다. 2022. 10. 31 최초작성 import pandas as pd df = pd.DataFrame({ 'alphabet': ['a', 'b', 'c', 'd'], 'integer' : [1, 2, 3, 4], 'blood type': ['A', 'B', 'AB', 'O'], }) print(df) ''' alphabet integer blood type 0 a 1 A 1 b 2 B 2 c 3 AB 3 d 4 O ''' # 행을 지우려면 행 인덱스 번호와 axis=0을 사용해야 합니다. # 두번째, 세번째 행이 삭제됩니다. df = df.drop([1,2], axis=0) print(df) ''' alphabet ..
Python/Pandas
2023. 10. 7.