We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the else condition indented wrongly?
def scale_value(value_dict): """ Calculate and return a dict of the value of input dict scaled to (0, 1) """ ranked_dict = [(user, value_dict[user]) for user in value_dict.keys()] ranked_dict = sorted(ranked_dict, reverse=True, key=lambda x: x[1]) up_max, up_mean, up_min = ranked_dict[0][1], ranked_dict[int(len(ranked_dict) / 2)][1], ranked_dict[-1][1] scale_dict = {} for i, p in value_dict.items(): norm_value = (p - up_min) / (up_max - up_min) if norm_value == 0: # avoid the 0 scale_dict[i] = 0 + 1e-7 elif norm_value == 1: # avoid the 1 scale_dict[i] = 1 - 1e-7 else: scale_dict[i] = norm_value return scale_dict
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is the else condition indented wrongly?
The text was updated successfully, but these errors were encountered: