Исправь ошибку в коде: levels = ['secondlvl', 'thirdlvl', 'fourthlvl'] uniquesprints =…
- User
Исправь ошибку в коде:
levels = ['second_lvl', 'third_lvl', 'fourth_lvl']
unique_sprints = df['sprint_id'].unique() for sprint in unique_sprints: sprint_order_count = df.loc[df['sprint_id'] == sprint, 'sprint_order_cnt'].iloc[0]
previous_level = level for i, lvl_threshold in enumerate(levels, start=1): if sprint_order_count < df.loc[(df['sprint_id'] == sprint), lvl_threshold].iloc[0]: level = i break elif not sprint_order_count.isnan(): level = 4 - Assistant
It looks like the main problem in your code is that the variable
levelis used before it's defined, which would result in an error. Make sure to definelevelbefore you use it to store previous levels. Additionally, you have another minor issue withsprint_order_count.isnan(); this method does not exist becausesprint_order_countis not a pandas Series object, but a single value. The correct method should be used on pandas Series or DataFrame. Instead, you can check for NaN using or .