Reputation: 1249
One would assume this has length 2*(60-18+1) = 86
, but it gives 100
when using len(obj)
:
import numpy as np;
series = ['{0}{1:02d}'.format(gender,age) for gender in ['M','F'] for age in np.linspace(18,60,dtype=int)]
print(len(series))
The question is, why?
Upvotes: 0
Views: 108
Reputation: 1519
NumPY's linspace
has an optional third argument which is the amount of samples to pull from the start to finish, by default it is 50, and with 2 Genders it would generate 100. To change it to what amount you would like, add a third argument with the amount you want per gender.
Upvotes: 3