I have the following code:
def get_preds(train,test,x_ranges,y_ranges):
global total_scores
global num_scores
for x_min, x_max in x_ranges:
for y_min, y_max in y_ranges:
...
When I run this method on python 2.7, it behaves as expected. The nest for loops runs for each time that the outer for loop runs.
When I loaded this same code onto the Kaggle python script engine which runs on Python 3, the nested loop only runs once. For all other iterations, it is skipped.
Here's how the method gets called:
dataset = pd.read_csv('../input/train.csv',dtype=types,index_col=0)
split_t=math.floor((0.9)*786239)
train = dataset[dataset.time < split_t]
test = dataset[dataset.time >= split_t]
def gen_ranges(size,step):
return zip(np.arange(0,size,step), np.arange(step, size+step, step));
x_ranges = gen_ranges(size,x_step)
y_ranges = gen_ranges(size,y_step)
preds_test_total = get_preds(train,test,x_ranges,y_ranges)