I'm a bit stuck trying to understand this line of code.
women_only_stats = data[0::,4] == "female"
I'm confused with the part of data. What exactly does the double colon mean with the comma 4 next to it?
This isn't a syntax error, and probably isn't even a mistake. We'd need to see data to be sure. Numpy arrays, among others, accept a tuple of slices as an index, so it's certainly not impossible.
See here for an introduction to numpy indexing.
The 0:: part is basically the same as : or ::, at least if we're using the standard slice interpretation. (Remember that slice objects can be made of many types, and so things like "A":10:(1,2) are perfectly valid syntactically-- it's the object's responsibility to decide how it wants to handle that input.)
I suspect that data is a numpy array looking something like
>>> data
array([[1, 2, 5, 12, 'male'],
[1, 2, 5, 12, 'female'],
[1, 2, 5, 12, 'female']], dtype=object)
>>> data[:,4]
array(['male', 'female', 'female'], dtype=object)
:,4, or ::,4, or 0::,4, all mean "give me every value along axis 0 (the rows), and column #4". We can then do a vectorized comparison:
>>> data[:,4] == "female"
array([False, True, True], dtype=bool)
Finally, we can use that to filter data:
>>> female_only_stats = data[:,4] == "female"
>>> data[female_only_stats]
array([[1, 2, 5, 12, 'female'],
[1, 2, 5, 12, 'female']], dtype=object)
[start:stop:step], where the comma comes from?