2
나는 파이썬과 NumPy를 사용하여이 문제를 해결하고있는 Kaggle Titanic tutorial을 따르려고합니다. 나는 데이터 [0 ::,]와 데이터 [0 :,]의 차이점을 이해하는데 어려움을 겪고있다. 차이가 없습니다numpy 배열을 필터링 할 때 0 :: 및 0의 차이점은 무엇입니까?
for i in xrange(number_of_classes): #loop through each class
for j in xrange(number_of_price_brackets): #loop through each price bin
women_only_stats = data[ # Which element
(data[0::, 4] == "female") & # is a female and
(data[0::, 2].astype(np.float) # was ith class
== i+1)
& # and
(data[0:, 9].astype(np.float) # was greater
>= j * fare_bracket_size) # than this bin
& # and
(data[0:, 9].astype(np.float) # less than
< (j+1)*fare_bracket_size) # the next bin
, 1] # in the 2nd col
결과가 변경되는지 확인하기 위해 전환을 시도 했습니까? 둘 다 슬라이스에서 기본'stop'과'step'을 사용하고 있습니다. – jonrsharpe
@wim ah 사실입니다.이 튜토리얼에서는 2.7을 사용하고 있습니다. 'numpy'가 실제로 그렇게합니까? – jonrsharpe
아니, 나는 OP의 경우 터플로 항상 getitem이기 때문에 착각했다. – wim