
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 import numpy as np import matplotlib.pyplot as plt N = 512 T = 1.0 / 44100.0 f1 = 697 f2 = 1209 t = np.linspace(0.0, N*T, N) y1 = 1.1 ..

RandomState는 다양한 확률 분포에서 추출한 난수를 생성하는 여러 가지 방법을 제공 1 2 3 4 5 6 7 import numpy as np from datetime import datetime random_number = np.random.RandomState(datetime.now().microsecond) print("datetime.now().microsecond",datetime.now().microsecond) #datetime.now().microsecond 600700 print(random_number) #RandomState(MT19937) Colored by Color Scripter cs

타이타닉 데이터를 기준으로 하였다. Kaggle 데이터를 사용해서 데이터를 pandas 를 사용해서 어떻게 잘 처리할 수 있는지 공부해보았다. *** 타이타닉 데이터 - 참고 train.py test.py 1. read_csv 파일 읽기 1 2 train = pd.read_csv('C:\\Users\\my\\Desktop\\input\\train.csv') test = pd.read_csv('C:\\Users\\\my\Desktop\\input\\test.csv') cs 2. train, test 정보확인하기 - info 함수 : 각 column의 정보보기 1 2 print(train.info()) print(test.info()) cs - head() 함수 : 앞 5줄의 정보만 간략하게 보기 1 2 p..

input_comma폴더 파일을 다음과 같이 6개가 존재한다. 파일은 다음과 같다. x_coordinate, y_coordinate, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 import pandas as pd import os path_dir = './input_comma/' #폴더명 file_list = os.listdir(path_dir) print(file_list) new_excel = pd.DataFrame( columns=['file_name','average1', 'average2', 'ave..
python - matplot(1) 기본
1. Deep learning에서 CNN은 학습하거나 TEST 하려는 이미지의 크기가 모두 동일해야 함 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 from PIL import Image import numpy as np img = Image.open("colorwheel.png") pix1 = np.array(img) # 이미지 1의 pixel 값 width, height = img.size # 이미지의 width와 height print(width, height) resize_image = img.resize((500, 1000)) # 이미지 resize pix2 = np.array(resize_image) width, height = resize_ima..
1. 기존파일 읽기 1 2 3 file_name = "example" print(file_name) read_excel = pd.read_csv(file_name) cs 2. 기존파일 셀 읽기 1 2 3 name1 = read_excel.iloc[j, 9] name2 = read_excel.iloc[j, 8] name3 = read_excel.iloc[j,10] cs 3. 새로운 파일 만들기 1 2 3 4 5 new_excel=pd.DataFrame(columns=['EventNumber','Station','Magnitude']) new_excel.loc[j]=[Event_number,Station,Magnitude] new_file_name="data.csv" new_excel.to_csv(new_f..
1. np.array 1 2 3 4 5 6 7 8 9 10 import numpy as np import array array_np = np.array([[2,3],[4,5]]) print("array_np",array_np) """ [[2 3] [4 5]] """ Colored by Color Scripter cs 2. np.arange 1 2 3 4 import numpy as np mylist=np.arange(4,9,1) print(mylist) #[4 5 6 7 8] cs 3. np.zeros 1 2 3 4 5 import numpy as np x = np.zeros(500) print(x) cs 4. np.concatenate 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1..