AttributeError: 'DatetimeIndex' object has no attribute 'apply'
解决办法
def day_night(data):
if data.hour >= 8 and data.hour < 20:
return 'day'
else:
return 'night'
a['is_night'] = a.index.map(day_night)
参考链接:
[1] datetimeindex object has no attribute apply.