Skip to content

Instantly share code, notes, and snippets.

@barszczmm
barszczmm / icb_industries.json
Last active November 1, 2021 20:37
Industry Classification Benchmark (http://en.wikipedia.org/wiki/Industry_Classification_Benchmark) in JSON format.
[
{
"icb": "0001",
"supersectors": [
{
"icb": "0500",
"name": "Oil & Gas",
"sectors": [
{
"icb": "0530",
@barszczmm
barszczmm / ranges_lists_utils.py
Last active January 3, 2016 10:09
Functions for combining/merging lists or tuples representing ranges and for subtracting ranges of one list of ranges from ranges of second list of ranges.
#!/usr/bin/env python
def combine_ranges(ranges, are_touching=lambda x, y: y - x == 1):
"""
Create new list of ranges combining ranges if they overlap
or touch each other.
Examples using integers:
>>> combine_ranges(((1,5), (3,7)))