Python
-
[Python] CSV/XLS 파일 활용
================================================ Sample – 1 csv 파일 읽고 표시 pip install xlrd pip install openpyxl ================================================ import pandas as pd folder1 = ‘/data/’ xls_file1 = folder1 + ‘usa1.xlsx’ csv_file1 = folder1 + ‘usa1.csv’ df…
-
[Python] NumPy 활용
배열 데이터 계산 NumPy =========================================================== Sample – 1 basic display *.reshape =========================================================== import numpy as np list1 = [0, 1, 2] abc = np.array(list1) print(abc) ========================================================== 데이터 구조화 Pandas ========================================================== Sample – 1…
-
[Python] 외부파일 다루기
맥북에서 파일에서 읽고 한줄 씩 출력하기 ================================================== Sample 1 – Read – Display ================================================== file_name = ‘/readtest1.txt’ f = open(file_name, ‘r’) lines = f.readlines() f.close() line_num = 0 for line in lines: line_No…