codeparrot-generation / examples.json
leandro
add examples
dc9a7be
[
{
"name": "Hello World!",
"value": "def print_hello_world():\n \"\"\"Print 'Hello World!'.\"\"\"",
"length": 8
},
{
"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": "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": "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
}
]