Loubna ben allal commited on
Commit
c745b43
1 Parent(s): 1c7be52

add examples

Browse files
Files changed (1) hide show
  1. examples.json +38 -0
examples.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Hello World!",
4
+ "value": "def print_hello_world():\n \"\"\"Print 'Hello World!'.\"\"\"",
5
+ "length": 8
6
+ },
7
+ {
8
+ "name": "Filesize",
9
+ "value": "def get_file_size(filepath):",
10
+ "length": 64
11
+ },
12
+ {
13
+ "name": "Python to Numpy",
14
+ "value": "# native Python:\ndef mean(a):\n return sum(a)/len(a)\n\n# with numpy:\nimport numpy as np\n\ndef mean(a):",
15
+ "length": 16
16
+ },
17
+ {
18
+ "name": "unittest",
19
+ "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",
20
+ "length": 64
21
+
22
+ },
23
+ {
24
+ "name": "Scikit-Learn",
25
+ "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",
26
+ "length": 96
27
+ },
28
+ {
29
+ "name": "Pandas",
30
+ "value": "# load dataframe from csv\ndf = pd.read_csv(filename)\n\n# columns: \"age_group\", \"income\"\n# calculate average income per age group",
31
+ "length": 16
32
+ },
33
+ {
34
+ "name": "Transformers",
35
+ "value": "from transformers import AutoTokenizer, AutoModelForSequenceClassification\n\n# build a BERT classifier",
36
+ "length": 48
37
+ }
38
+ ]