I have the following loop
LDFail = pd.DataFrame(data, columns=['ws_ms', 'large_door_failure', 'damage_state', '_project']) Failure = LDFail['large_door_failure'] DamageState = [] for x in Failure: if (Failure == pd.Series['No','None', [0],'Unknown']).any(): DamageState.append(0) else: DamageState.append(1) When I try and determine if there is a large door failure (which can be any of the four values) I get the error:
if (Failure == pd.Series['No','None', [0],'Unknown']).any(): TypeError: 'type' object is not subscriptable https://stackoverflow.com/questions/66702520/type-object-is-not-subscriptable-if-loop-error March 19, 2021 at 12:32PM
没有评论:
发表评论