본문 바로가기
2/[ Machine Learning ]

How do I select a pandas Series from a DataFrame

by Kieran_Han 2020. 11. 26.

Source: youtu.be/zxqjeyKP2Tk

ufo = pd.read_table('http://bit.ly/uforeports', sep=',')

type(ufo) #pandas.core.frame.DataFrame 여부 확인

ufo.head()

ufo['City'] #ufo.City로 입력해도 동일. ufo['City']보다 입력하기 편리하므로 ufo.City사용

ufo['Colors Reported'] #ufo.Color_Reported로 입력해서 출력되지 않으면, ['Colors Reported'] 방법 사용

#이미 입력되어 있는 Column들을 새로 만들어서 Column 추가 가능

ufo.City + ufo.State

ufo.City + ', ' + ufo.State

#New Column 생성

ufo['Location'] = ufo.City + ', ' + ufo.State

ufo.head()

 

' > [ Machine Learning ]' 카테고리의 다른 글

MNIST  (0) 2020.12.03
Overfitting  (0) 2020.12.02
Machine Learning System의 종류  (0) 2020.12.02
Why do some pandas commands end with parentheses, and others don't?  (0) 2020.11.26
How do I read a tabular data file into pandas?  (0) 2020.11.26