gpt4 book ai didi

python - 过滤 numpy 数组时 0::和 0: 之间有什么区别?

转载 作者:太空宇宙 更新时间:2023-11-04 03:10:21 25 4
gpt4 key购买 nike

<分区>

我正在尝试关注 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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com