|
347 | 347 | " non_zero_indices = np.nonzero(tv_count_array)[0].astype(int)\n",
|
348 | 348 | " non_zero_values = tv_count_array[non_zero_indices].astype(int)\n",
|
349 | 349 | " outer_part = counter * slice_size\n",
|
350 |
| - " non_zero_dict = {\n", |
351 |
| - " int(k + outer_part): int(v)\n", |
352 |
| - " for k, v in dict(zip(non_zero_indices, non_zero_values)).items()\n", |
353 |
| - " }\n", |
| 350 | + " non_zero_dict = {int(k + outer_part): int(v) for k, v in dict(zip(non_zero_indices, non_zero_values)).items()}\n", |
354 | 351 | " tmdb_id_value_counts.update(non_zero_dict)\n",
|
355 | 352 | " counter += 1\n",
|
356 |
| - " stats[\"value_counts\"] = dict(\n", |
357 |
| - " sorted(tmdb_id_value_counts.items(), key=lambda item: item[1], reverse=True)\n", |
358 |
| - " )\n", |
| 353 | + " stats[\"value_counts\"] = dict(sorted(tmdb_id_value_counts.items(), key=lambda item: item[1], reverse=True))\n", |
359 | 354 | " return stats\n",
|
360 | 355 | "\n",
|
361 | 356 | "\n",
|
|
380 | 375 | " top_5_summary = {}\n",
|
381 | 376 | " top_5_summary[\"avg_time\"] = round(all_results[\"total_time\"] / num_parties)\n",
|
382 | 377 | " top_5_summary[\"avg_views\"] = round(all_results[\"total_views\"] / num_parties)\n",
|
383 |
| - " top_5_summary[\"avg_unique_show_views\"] = round(\n", |
384 |
| - " all_results[\"total_unique_show_views\"] / num_parties\n", |
385 |
| - " )\n", |
| 378 | + " top_5_summary[\"avg_unique_show_views\"] = round(all_results[\"total_unique_show_views\"] / num_parties)\n", |
386 | 379 | " top_5_summary[\"top_5\"] = dict(\n",
|
387 |
| - " sorted(\n", |
388 |
| - " all_results[\"value_counts\"].items(), key=lambda item: item[1], reverse=True\n", |
389 |
| - " )[:top_k]\n", |
| 380 | + " sorted(all_results[\"value_counts\"].items(), key=lambda item: item[1], reverse=True)[:top_k]\n", |
390 | 381 | " )\n",
|
391 | 382 | " return top_5_summary\n",
|
392 | 383 | "\n",
|
|
0 commit comments