"키 오류 : 'tempMax'"오류가 발생합니다.사전 키 오류 python
는 사람이 문제는 다음 코드로 무엇을 말할 수 : 하루는 등 평균 온도, 최대 온도와 같은 변수가 객체가
def catagorise(self, day, cat, f):
self.features.setdefault(cat, {f:{'high':0,'mid':0,'low':0}})
if f == 'tempMean':
if day.tempMean > 15.0:
self.features[cat][f]['high'] += 1
elif day.tempMean > 8.0 and day.tempMean < 15.0:
self.features[cat][f]['mid'] += 1
elif day.tempMean <= 8.0:
self.features[cat][f]['low'] += 1
if f == 'tempMax':
if day.tempMax > 15.0:
self.features[cat][f]['high'] += 1
elif day.tempMax > 8.0 and day.tempMax < 15.0:
self.features[cat][f]['mid'] += 1
elif day.tempMax <= 8.0:
self.features[cat][f]['low'] += 1
고양이가 투입 될 카테고리입니다 예 : '안개', '비', '눈', '없음', f는 확인 기능입니다. 'tempMax'
피쳐 사전은 클래스 생성시 정의됩니다.
및 나머지 추적? – MattH
@MattH 나머지 추적 표시가 수수께끼를 망칠 것입니다. – joaquin