| `weights` - ``int`` list | possible values - ``0`` / ``1`` * ``0`` if lower values have higher weight in the data set * ``1`` if higher values have higher weight in the data set >>> procentual_proximity([[20, 60, 2012],[23, 90, 2015],[22, 50, 2011]], [0, 0, 1]) [
(
source_data: list[list[float]], weights: list[int]
)
| 95 | |
| 96 | |
| 97 | def procentual_proximity( |
| 98 | source_data: list[list[float]], weights: list[int] |
| 99 | ) -> list[list[float]]: |
| 100 | """ |
| 101 | | `weights` - ``int`` list |
| 102 | | possible values - ``0`` / ``1`` |
| 103 | |
| 104 | * ``0`` if lower values have higher weight in the data set |
| 105 | * ``1`` if higher values have higher weight in the data set |
| 106 | |
| 107 | >>> procentual_proximity([[20, 60, 2012],[23, 90, 2015],[22, 50, 2011]], [0, 0, 1]) |
| 108 | [[20, 60, 2012, 2.0], [23, 90, 2015, 1.0], [22, 50, 2011, 1.3333333333333335]] |
| 109 | """ |
| 110 | |
| 111 | data_lists = get_data(source_data) |
| 112 | score_lists = calculate_each_score(data_lists, weights) |
| 113 | final_scores = generate_final_scores(score_lists) |
| 114 | |
| 115 | # append scores to source data |
| 116 | for i, ele in enumerate(final_scores): |
| 117 | source_data[i].append(ele) |
| 118 | |
| 119 | return source_data |
nothing calls this directly
no test coverage detected