파이썬 Pandas로 CSV를 읽는 동안 열 유형 설정
다음 형식으로 csv 파일을 pandas 데이터 프레임으로 읽으려고합니다. dp = pd.read_csv('products.csv', header = 0, dtype = {'name': str,'review': str, 'rating': int,'word_count': dict}, engine = 'c') print dp.shape for col in dp.columns: print 'column', col,':', type(col[0]) print type(dp['rating'][0]) dp.head(3) 다음은 출력입니다. (183531, 4) column name : column review : column rating : column word_count : 그건 그렇고, 엔진이나 헤더를 지정하지 ..
2020. 11. 7.