Python_EX-003. how to extract a condition dataset
import numpy as np# INPUT : SCORE ClassA = [10, 50, 70, 30]ClassB = [30, 40, 50, 60]ClassC = [76, 78, 92, 30]ClassD = [32, 45, 64, 42]A = np.array(ClassA).reshape(1,4)B = np.array(ClassB).reshape(1,4)C = np.array(ClassC).reshape(1,4)D = np.array(ClassD).reshape(1,4)Score = np.concatenate( (A, B, C, D), axis=0)print("""Score :""", Score)#path = ''#data = np.loadtxt(path, delimiter=',')cond = Scor..
Python_N-006. Array Slicing
>>> a[ 0, 3:5 ]array( [3, 4] )>>> a[ 4:, 4: ]array( [ [44, 45], [54, 55] ] )>>> a[ :, 2]array( [ 2, 12, 22, 32, 42, 52 ] )>>>> a[ 1:5:3, ::2 ]array( [ [10, 12, 14,], [40, 42, 44] ] )
Python_N-005. Array Broadcasting
General broadcasting rule Two dimensions are compatible when 1. they are equal, or 2. one of them is 1. No.Example Code 1import numpy as np a = np.array( [1.0, 2.0, 3.0] ) b = 2.0 a * b an array and a scalar value are combined in an operation: 2import numpy as np a = np.array( [ [ 0.0, 0.0, 0.0], [10.0, 10.0, 10.0], [20.0, 20.0, 20.0], ..