Python snippets
Short, self-contained Python functions you can drop into any project.
| Snippet |
Tags |
| add_days |
date |
| all_equal |
list |
| all_unique |
list |
| arithmetic_progression |
math, list |
| average |
math, list |
| average_by |
math, list |
| bifurcate |
list |
| bifurcate_by |
list |
| binomial_coefficient |
math |
| byte_size |
string |
| camel |
string |
| capitalize |
string |
| capitalize_every_word |
string |
| cast_list |
list |
| celsius_to_fahrenheit |
math |
| check_prop |
object |
| chunk |
list |
| chunk_into_n |
list |
| clamp_number |
math |
| collect_dictionary |
dict |
| combine_values |
dict |
| compact |
list |
| compose |
function |
| compose_right |
function |
| count_by |
list |
| count_occurrences |
list |
| cumsum |
math, list |
| curry |
function |
| daterange |
date |
| days_ago |
date |
| days_diff |
date |
| days_from_now |
date |
| decapitalize |
string |
| deep_flatten |
list |
| degrees_to_rads |
math |
| delay |
function |
| dict_to_list |
dict |
| difference |
list |
| difference_by |
list |
| digitize |
math |
| drop |
list |
| drop_right |
list |
| every |
list |
| every_nth |
list |
| factorial |
math |
| fahrenheit_to_celsius |
math |
| fibonacci |
math, list |
| filter_non_unique |
list |
| filter_unique |
list |
| find |
list |
| find_index |
list |
| find_index_of_all |
list |
| find_key |
dict |
| find_keys |
dict |
| find_last |
list |
| find_last_index |
list |
| find_parity_outliers |
math, list |
| flatten |
list |
| for_each |
list |
| for_each_right |
list |
| frequencies |
list |
| from_iso_date |
date |
| gcd |
math |
| geometric_progression |
math, list |
| get |
dict |
| group_by |
list |
| hamming_distance |
math, string |
| has_duplicates |
list |
| have_same_contents |
list |
| head |
list |
| hex_to_rgb |
math |
| in_range |
math |
| includes_all |
list |
| includes_any |
list |
| index_of_all |
list |
| initial |
list |
| initialize_2d_list |
list |
| initialize_list_with_range |
list |
| initialize_list_with_values |
list |
| intersection |
list |
| intersection_by |
list |
| invert_dictionary |
dict |
| is_anagram |
string |
| is_contained_in |
list |
| is_divisible |
math |
| is_even |
math |
| is_odd |
math |
| is_prime |
math |
| is_weekday |
date |
| is_weekend |
date |
| kebab |
string |
| key_in_dict |
dict |
| key_of_max |
dict |
| key_of_min |
dict |
| keys_only |
dict |
| km_to_miles |
math |
| last |
list |
| lcm |
math |
| longest_item |
list |
| map_dictionary |
dict |
| map_values |
dict |
| max_by |
list |
| max_element_index |
list |
| max_n |
list |
| median |
math, list |
| merge |
dict |
| merge_dictionaries |
dict |
| miles_to_km |
math |
| min_by |
list |
| min_element_index |
list |
| min_n |
list |
| months_diff |
date |
| most_frequent |
list |
| n_times_string |
string |
| none |
list |
| num_to_range |
math |
| offset |
list |
| pad |
string |
| pad_number |
math, string |
| palindrome |
string |
| pluck |
list |
| powerset |
math, list |
| rads_to_degrees |
math |
| reverse |
list |
| reverse_number |
math |
| rgb_to_hex |
math |
| roll |
list |
| sample |
list |
| shuffle |
list |
| similarity |
list |
| slugify |
string |
| snake |
string |
| some |
list |
| sort_by_indexes |
list |
| sort_dict_by_key |
dict |
| sort_dict_by_value |
dict |
| split_lines |
string |
| spread |
list |
| sum_by |
math, list |
| sum_of_powers |
math |
| symmetric_difference |
list |
| symmetric_difference_by |
list |
| tail |
list |
| take |
list |
| take_right |
list |
| to_binary |
math |
| to_dictionary |
dict |
| to_hex |
math |
| to_iso_date |
date |
| to_roman_numeral |
math |
| transpose |
list |
| unfold |
list |
| union |
list |
| union_by |
list |
| unique_elements |
list |
| values_only |
dict |
| weighted_average |
math |
| when |
function |
| words |
string |