IndentationError: expected an indented block
Python严格地要求代码缩进,缩进的代码块相对于上一级是从属关系。用if语句举个例子:
if a==2: print ‘hello world’if语句的条件为真时会执行print语句,print语句是if语句的从属代码块,代表从属关系,print语句之前有4个空格。如果if语句没有任何从属的代码块就会报错expected an indented block。与if语句类似的,必须包含从属代码块的还有while、for、try-except等。
for i in range(1,len(data)):
if data['6点非预约在线时长(分钟)'][i]>0&data['7点非预约在线时长(分钟)'][i]>0&data['8点非预约在线时长(分钟)'][i]>0:
data['早高峰在线情况'][i] = '早高峰在线司机'
elif data['6点非预约在线时长(分钟)'][i]=0&data['7点非预约在线时长(分钟)'][i]>0&data['8点非预约在线时长(分钟)'][i]>0:
data['早高峰在线情况'][i] = '7点在线司机'
elif data['6点非预约在线时长(分钟)'][i]=0&data['7点非预约在线时长(分钟)'][i]=0&data['8点非预约在线时长(分钟)'][i]>0:
data['早高峰在线情况'][i] = '8点在线司机'
else:
data['早高峰在线情况'][i] = '待定司机'