Python - Pandas str.get(), idmax(), replace()
·
Python/Python 기초문법
str.get(i) i index의 문자열을 출력 예시) 데이터 불러오기 titanic = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv") titanic 해당 데이터에서 Name의 값들을 ,로 구분하고 Surname이라는 열 추가하여 Surname 값에 이름을 추가 titanic['Surname'] = titanic['Name'].str.split(',').str.get(0) titanic idxmax() 최대값을 가지는 인덱스 레이블 출력 예시) 가장 이름이 긴 승객의 인덱스 titanic['Name'].str.len().idxmax() ---------------------------..