<分区> 分区>
我正在尝试关注 Kaggle Titanic tutorial那就是使用 Python 和 NumPy 解决问题。我很难理解 data[0::, ] 和 data[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
