list

Utils for operating on lists.

Functions

list_closest_to_median

Return element from list that's closest to list mean.

stats

Compute min, max, avg, std of vals.

val2list

Repeat val for repeat_time times and return the list or val if list/tuple.

val2tuple

Return tuple with min_len by repeating element at idx_repeat.

list_closest_to_median(x)

Return element from list that’s closest to list mean.

Parameters:

x (list)

Return type:

Any

stats(vals)

Compute min, max, avg, std of vals.

Parameters:

vals (list[float])

Return type:

dict[str, float]

val2list(val, repeat_time=1)

Repeat val for repeat_time times and return the list or val if list/tuple.

Parameters:
  • val (list | tuple | Any)

  • repeat_time (int)

Return type:

list

val2tuple(val, min_len=1, idx_repeat=-1)

Return tuple with min_len by repeating element at idx_repeat.

Parameters:
  • val (list | tuple | Any)

  • min_len (int)

  • idx_repeat (int)

Return type:

tuple