File size: 1,545 Bytes
c745b43
 
 
 
 
 
fc5cf35
 
 
6be3129
fc5cf35
 
 
 
 
 
c745b43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[
    {
        "name": "Hello World!",
        "value": "def print_hello_world():\n    \"\"\"Print 'Hello World!'.\"\"\"",
        "length": 8
    },
    {
        "name": "Is_in_list",
        "value": "def is_in_list(L, e):\n    \"\"\"Find if list L contains the element e.\"\"\"",
        "length": 32
    },
    {
        "name": "Scikit-Learn",
        "value": "import numpy as np\nfrom sklearn.ensemble import RandomForestClassifier\n\n# create training data\nX = np.random.randn(100, 100)\ny = np.random.randint(0, 1, 100)\n\n# setup train test split",
        "length": 96
    },
    {
        "name": "Filesize",
        "value": "def get_file_size(filepath):",
        "length": 64
    },
    {
        "name": "Python to Numpy",
        "value": "# native Python:\ndef mean(a):\n    return sum(a)/len(a)\n\n# with numpy:\nimport numpy as np\n\ndef mean(a):",
        "length": 16
    },
    {
        "name": "unittest",
        "value": "def is_even(value):\n    \"\"\"Returns True if value is an even number.\"\"\"\n    return value % 2 == 0\n\n# setup unit tests for is_even\nimport unittest",
        "length": 64

    },
    {
        "name": "Pandas",
        "value": "# load dataframe from csv\ndf = pd.read_csv(filename)\n\n# columns: \"age_group\", \"income\"\n# calculate average income per age group",
        "length": 16
    },
    {
        "name": "Transformers",
        "value": "from transformers import AutoTokenizer, AutoModelForSequenceClassification\n\n# build a BERT classifier",
        "length": 48
    }
]