Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ValueError
Message: Expected object or value
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1827, in _prepare_split_single
for key, table in generator:
^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 613, in wrapped
for item in generator(*args, **kwargs):
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 281, in _generate_tables
examples = [ujson_loads(line) for line in batch.splitlines()]
~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/utils/json.py", line 20, in ujson_loads
return pd.io.json.ujson_loads(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
ValueError: Expected object or value
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
~~~~~~~~~~~~~~~~~~~~~~~~~^
builder, max_dataset_size_bytes=max_dataset_size_bytes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1694, in _prepare_split
for job_id, done, content in self._prepare_split_single(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1880, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
id string | kind string | title string | provisional bool | output_code string | input_data_sample string | output_data_sample unknown | transformation_instruction string | filename string | contentType string | checksumSha256 string |
|---|---|---|---|---|---|---|---|---|---|---|
8f71c7f9-bacf-404c-8935-c567d50f60f3 | sponsor_example | null | null | null | null | null | null | three-samples-1.json | application/json | 042579e2858aa121c3c99001d6e8722175dbf251036cb49438949ef19178a73b |
d0809911-5c7f-4358-b12f-da9588a3f145 | sponsor_example | null | null | null | null | null | null | three-samples-2.json | application/json | 9d5ca61bf9da7feddf4aa1b5e8bb409096bd363a52b775a2a13bc5215cff4347 |
5d71de31-d454-40f1-83e9-446613a97525 | sponsor_example | null | null | null | null | null | null | three-samples-3.json | application/json | 82c6ac8acd0cb4a80968be8ca31354d42f28acf55c3ed1103e57462b6011163b |
cmsl783g4000gw6p2q75jnyxp | contributor_item | Submission 5JNYXP | false | def transform(input):
rows = []
for order in input:
for item in order["items"]:
rows.append({"order_id": order["order_id"], "sku": item["sku"], "line_total_cents": item["qty"] * item["unit_cents"]})
return rows | [{"order_id": "o-1", "items": [{"sku": "A", "qty": 2, "unit_cents": 300}, {"sku": "B", "qty": 1, "unit_cents": 1250}]}, {"order_id": "o-2", "items": [{"sku": "A", "qty": 3, "unit_cents": 300}]}] | [
{
"order_id": "o-1",
"sku": "A",
"line_total_cents": 600
},
{
"order_id": "o-1",
"sku": "B",
"line_total_cents": 1250
},
{
"order_id": "o-2",
"sku": "A",
"line_total_cents": 900
}
] | Define transform(input) to flatten orders into one row per line item with order_id, sku, and line_total_cents (qty times unit_cents), preserving input order. | null | null | null |
cmsl783g4000jw6p2goj8ou2a | contributor_item | Submission J8OU2A | false | def transform(input):
out = []
for line in input:
if not line:
continue
parsed = {}
for pair in line.split(";"):
key, value = pair.split("=", 1)
if value.isdigit():
parsed[key] = int(value)
elif value in ("true", "false"):
... | ["retries=4;debug=true;region=eu-west", "retries=0;debug=false", ""] | [
{
"retries": 4,
"debug": true,
"region": "eu-west"
},
{
"retries": 0,
"debug": false
}
] | Define transform(input) to parse each non-empty 'key=value;key=value' string into a dict, converting digit strings to int and true/false to booleans, returning the list of dicts. | null | null | null |
cmsl783g4000hw6p2rn7fqufe | contributor_item | Submission 7FQUFE | false | def transform(input):
latest = {}
for row in input:
current = latest.get(row["user"])
if current is None or row["version"] > current["version"]:
latest[row["user"]] = row
return [latest[u] for u in sorted(latest)] | [{"user": "u-1", "version": 2, "plan": "pro"}, {"user": "u-2", "version": 1, "plan": "free"}, {"user": "u-1", "version": 5, "plan": "team"}, {"user": "u-2", "version": 3, "plan": "pro"}] | [
{
"user": "u-1",
"version": 5,
"plan": "team"
},
{
"user": "u-2",
"version": 3,
"plan": "pro"
}
] | Define transform(input) to keep only the record with the highest version per user, returned as a list sorted by user ascending. | null | null | null |
cmsl783g4000fw6p2mzfsm0ce | contributor_item | Submission FSM0CE | false | def transform(input):
totals = {}
for row in input:
totals[row["dept"]] = totals.get(row["dept"], 0) + row["amount_cents"]
return [{"dept": d, "total_cents": t} for d, t in sorted(totals.items(), key=lambda kv: (-kv[1], kv[0]))] | [{"dept": "ops", "amount_cents": 1250}, {"dept": "eng", "amount_cents": 400}, {"dept": "ops", "amount_cents": 750}, {"dept": "hr", "amount_cents": 90}] | [
{
"dept": "ops",
"total_cents": 2000
},
{
"dept": "eng",
"total_cents": 400
},
{
"dept": "hr",
"total_cents": 90
}
] | Define transform(input) to total amount_cents per dept and return a list of {dept, total_cents} sorted by total_cents descending, then dept ascending for ties. | null | null | null |
cmsl783g4000iw6p2h9crt8p2 | contributor_item | Submission CRT8P2 | false | def transform(input):
distinct = sorted({r["score"] for r in input}, reverse=True)
rank_of = {score: i + 1 for i, score in enumerate(distinct)}
return [{**r, "rank": rank_of[r["score"]]} for r in input] | [{"name": "ada", "score": 91}, {"name": "ben", "score": 78}, {"name": "cy", "score": 91}, {"name": "di", "score": 60}] | [
{
"name": "ada",
"score": 91,
"rank": 1
},
{
"name": "ben",
"score": 78,
"rank": 2
},
{
"name": "cy",
"score": 91,
"rank": 1
},
{
"name": "di",
"score": 60,
"rank": 3
}
] | Define transform(input) to add a dense rank field where the highest score is rank 1 and equal scores share a rank, keeping the original record order. | null | null | null |
cmsmtcq8j0057dmp2yqibn27v | contributor_item | Submission IBN27V | false | def transform(input):
return [{"name": r["name"], "total": sum(r["vals"])} for r in input] | [{"name":"a","vals":[1,2,3]},{"name":"b","vals":[10]}] | [
{
"name": "a",
"total": 6
},
{
"name": "b",
"total": 10
}
] | Define transform(input) to return name and the sum of its vals as total. | null | null | null |
cmsmtcq8j004tdmp2ryxovaa9 | contributor_item | Submission XOVAA9 | false | def transform(input):
return [{**r, "ctr": round(r["clicks"] / r["views"], 2)} for r in input] | [{"q":"shoes","clicks":40,"views":100},{"q":"hats","clicks":10,"views":50}] | [
{
"q": "shoes",
"clicks": 40,
"views": 100,
"ctr": 0.4
},
{
"q": "hats",
"clicks": 10,
"views": 50,
"ctr": 0.2
}
] | Define transform(input) to add ctr, the clicks divided by views rounded to two decimals. | null | null | null |
cmsmtcq8j004rdmp2ql8m9fx7 | contributor_item | Submission 8M9FX7 | false | def transform(input):
return [r["sku"] for r in input if r["in_stock"]] | [{"sku":"A","in_stock":true},{"sku":"B","in_stock":false},{"sku":"C","in_stock":true}] | [
"A",
"C"
] | Define transform(input) to return the list of skus that are in stock. | null | null | null |
cmsmtcq8j004qdmp2ocx3pubv | contributor_item | Submission X3PUBV | false | def transform(input):
return [{**r, "full_name": r["first"] + " " + r["last"]} for r in input] | [{"first":"Ada","last":"Lovelace"},{"first":"Alan","last":"Turing"}] | [
{
"first": "Ada",
"last": "Lovelace",
"full_name": "Ada Lovelace"
},
{
"first": "Alan",
"last": "Turing",
"full_name": "Alan Turing"
}
] | Define transform(input) to add full_name as first and last joined by a space. | null | null | null |
cmsmtcq8j004ndmp2f19dcm98 | contributor_item | Submission 9DCM98 | false | def transform(input):
return [r for r in input if r["tags"]] | [{"id":1,"tags":["a","b"]},{"id":2,"tags":[]},{"id":3,"tags":["x"]}] | [
{
"id": 1,
"tags": [
"a",
"b"
]
},
{
"id": 3,
"tags": [
"x"
]
}
] | Define transform(input) to keep only records that have at least one tag. | null | null | null |
cmsmtcq8j0056dmp2026vvq7k | contributor_item | Submission 6VVQ7K | false | def transform(input):
def letter(g):
if g >= 90:
return "A"
if g >= 70:
return "B"
return "F"
return [{**r, "letter": letter(r["grade"])} for r in input] | [{"grade":55},{"grade":72},{"grade":90},{"grade":40}] | [
{
"grade": 55,
"letter": "F"
},
{
"grade": 72,
"letter": "B"
},
{
"grade": 90,
"letter": "A"
},
{
"grade": 40,
"letter": "F"
}
] | Define transform(input) to add a letter field: A for 90+, B for 70-89, otherwise F. | null | null | null |
cmsmtcq8j004sdmp2l08f8ale | contributor_item | Submission 8F8ALE | false | def transform(input):
return [s.strip().lower() for s in input] | [" hello ","WORLD"," Foo "] | [
"hello",
"world",
"foo"
] | Define transform(input) to return each string trimmed of whitespace and lowercased. | null | null | null |
cmsmtcq8j004odmp2fd40uwy5 | contributor_item | Submission 40UWY5 | false | def transform(input):
return sorted(input, reverse=True) | [5,3,9,1,7] | [
9,
7,
5,
3,
1
] | Define transform(input) to return the numbers sorted in descending order. | null | null | null |
cmsmtcq8j004zdmp2b967kh4t | contributor_item | Submission 67KH4T | false | def transform(input):
counts = {}
for s in input:
counts[s] = counts.get(s, 0) + 1
return counts | ["error","info","error","warning","info","error"] | {
"error": 3,
"info": 2,
"warning": 1
} | Define transform(input) to return a frequency count of each distinct string. | null | null | null |
cmsmtcq8j004wdmp2k9rzrp85 | contributor_item | Submission RZRP85 | false | def transform(input):
total = 0
out = []
for r in input:
total += r["sales"]
out.append({**r, "cumulative": total})
return out | [{"date":"2026-01-01","sales":100},{"date":"2026-01-02","sales":150},{"date":"2026-01-03","sales":120}] | [
{
"date": "2026-01-01",
"sales": 100,
"cumulative": 100
},
{
"date": "2026-01-02",
"sales": 150,
"cumulative": 250
},
{
"date": "2026-01-03",
"sales": 120,
"cumulative": 370
}
] | Define transform(input) to add a cumulative running total field named cumulative. | null | null | null |
cmsmtcq8j004xdmp29t38bn9b | contributor_item | Submission 38BN9B | false | def transform(input):
return [{"email": r["email"].lower()} for r in input] | [{"email":"A@X.com"},{"email":"b@Y.COM"}] | [
{
"email": "a@x.com"
},
{
"email": "b@y.com"
}
] | Define transform(input) to lowercase every email value in place. | null | null | null |
cmsmtcq8j004mdmp2y9fi2fk3 | contributor_item | Submission FI2FK3 | false | def transform(input):
return [{"word": w, "length": len(w)} for w in input] | ["apple","banana","cherry"] | [
{
"word": "apple",
"length": 5
},
{
"word": "banana",
"length": 6
},
{
"word": "cherry",
"length": 6
}
] | Define transform(input) to return a list of {word, length} objects for each string. | null | null | null |
cmsmtcq8i004jdmp2rks3ss5f | contributor_item | Submission S3SS5F | false | def transform(input):
return [{**r, "passed": r["score"] >= 80} for r in input] | [{"name":"Ann","score":82},{"name":"Bo","score":91},{"name":"Cy","score":74}] | [
{
"name": "Ann",
"score": 82,
"passed": true
},
{
"name": "Bo",
"score": 91,
"passed": true
},
{
"name": "Cy",
"score": 74,
"passed": false
}
] | Define transform(input) to return each record with a passed flag set to True when score >= 80. | null | null | null |
cmsmtcq8j004vdmp2e8907kvp | contributor_item | Submission 907KVP | false | def transform(input):
return [n * 2 for n in input if n % 2 == 0] | [1,2,3,4,5,6] | [
4,
8,
12
] | Define transform(input) to return only the even numbers, each doubled. | null | null | null |
cmsmtcq8j0052dmp297y434sp | contributor_item | Submission Y434SP | false | def transform(input):
return [{"first": r["first"].capitalize(), "age": r["age"]} for r in input] | [{"first":"jane","age":30},{"first":"mark","age":45}] | [
{
"first": "Jane",
"age": 30
},
{
"first": "Mark",
"age": 45
}
] | Define transform(input) to capitalize the first name and keep age unchanged. | null | null | null |
cmsmtcq8j004pdmp2sjglekks | contributor_item | Submission GLEKKS | false | def transform(input):
totals = {}
for r in input:
totals[r["user"]] = totals.get(r["user"], 0) + r["amount"]
return totals | [{"user":"a","amount":10},{"user":"b","amount":20},{"user":"a","amount":5}] | {
"a": 15,
"b": 20
} | Define transform(input) to return a mapping of user to their total amount. | null | null | null |
cmsmtcq8j004kdmp2tdkb606e | contributor_item | Submission KB606E | false | def transform(input):
return [{**r, "temp_f": int(r["temp_c"] * 9 / 5 + 32)} for r in input] | [{"city":"NYC","temp_c":20},{"city":"LA","temp_c":25}] | [
{
"city": "NYC",
"temp_c": 20,
"temp_f": 68
},
{
"city": "LA",
"temp_c": 25,
"temp_f": 77
}
] | Define transform(input) to add temp_f, the Fahrenheit equivalent of temp_c, as an integer. | null | null | null |
cmsmtcq8j004ldmp244i377nf | contributor_item | Submission I377NF | false | def transform(input):
return [{"item": r["item"], "subtotal": r["qty"] * r["price"]} for r in input] | [{"item":"pen","qty":3,"price":2},{"item":"pad","qty":2,"price":5}] | [
{
"item": "pen",
"subtotal": 6
},
{
"item": "pad",
"subtotal": 10
}
] | Define transform(input) to return item and subtotal, where subtotal is qty times price. | null | null | null |
cmsmtcq8j004ydmp2pbgclm0s | contributor_item | Submission GCLM0S | false | def transform(input):
return [{**r, "price": r["cost"] * (1 + r["margin"])} for r in input] | [{"product":"x","cost":40,"margin":0.25},{"product":"y","cost":100,"margin":0.5}] | [
{
"product": "x",
"cost": 40,
"margin": 0.25,
"price": 50
},
{
"product": "y",
"cost": 100,
"margin": 0.5,
"price": 150
}
] | Define transform(input) to add price, computed as cost times one plus margin. | null | null | null |
cmsmtcq8j0054dmp2p0578wzy | contributor_item | Submission 578WZY | false | def transform(input):
return {r["k"]: r["v"] for r in sorted(input, key=lambda x: x["k"])} | [{"k":"b","v":2},{"k":"a","v":1},{"k":"c","v":3}] | {
"a": 1,
"b": 2,
"c": 3
} | Define transform(input) to build a single dict mapping k to v, sorted by key. | null | null | null |
cmsmtcq8j0051dmp22b2vinix | contributor_item | Submission 2VINIX | false | def transform(input):
return {"total": len(input), "active_count": sum(1 for r in input if r["active"])} | [{"id":1,"active":true},{"id":2,"active":true},{"id":3,"active":false}] | {
"total": 3,
"active_count": 2
} | Define transform(input) to return a summary object with total and active_count. | null | null | null |
cmsmtcq8j0053dmp27crbz6nu | contributor_item | Submission RBZ6NU | false | def transform(input):
return [n for n in input if n % 5 == 0 and n > 20] | [10,25,30,45,50] | [
25,
30,
45,
50
] | Define transform(input) to return only values that are multiples of 5 and greater than 20. | null | null | null |
cmsmtcq8j004udmp2zlk1x64d | contributor_item | Submission K1X64D | false | def transform(input):
return sorted(input, key=lambda r: r["value"]) | [{"name":"a","value":3},{"name":"b","value":1},{"name":"c","value":2}] | [
{
"name": "b",
"value": 1
},
{
"name": "c",
"value": 2
},
{
"name": "a",
"value": 3
}
] | Define transform(input) to sort the records by value ascending. | null | null | null |
cmsmtcq8j0050dmp2vogtcrno | contributor_item | Submission GTCRNO | false | def transform(input):
return [{"n": r["n"], "avg_rating": round(sum(r["reviews"]) / len(r["reviews"]), 1)} for r in input] | [{"n":"widget","reviews":[5,4,3]},{"n":"gadget","reviews":[2,2]}] | [
{
"n": "widget",
"avg_rating": 4
},
{
"n": "gadget",
"avg_rating": 2
}
] | Define transform(input) to add avg_rating, the mean of reviews rounded to one decimal. | null | null | null |
cmso87a6800c56zp25b7nd2xc | contributor_item | Submission 7ND2XC | false | import json
def transform(s):
d={}
for p in s.split(';'):
k,v=p.split(':'); d[k]=d.get(k,0)+int(v)
return json.dumps(dict(sorted(d.items()))) | a:1;b:2;a:3 | {
"a": 4,
"b": 2
} | Sum repeated key values from semicolon-separated pairs and return sorted JSON. | null | null | null |
cmso87a6800c66zp2q0jwijma | contributor_item | Submission JWIJMA | false | import json,itertools
def transform(s): return json.dumps(list(itertools.accumulate(json.loads(s)))) | [3,1,4,1,5] | [
3,
4,
8,
9,
14
] | Parse a JSON integer array and return its cumulative sums as JSON. | null | null | null |
cmso87a6800bg6zp2jvq0svhg | contributor_item | Submission Q0SVHG | false | import json
from collections import Counter
def transform(s): return json.dumps(dict(sorted(Counter(s.split()).items()))) | red red blue green red blue | {
"blue": 2,
"green": 1,
"red": 3
} | Count whitespace-separated words and return a JSON object sorted by word. | null | null | null |
cmsrb1sp10006e0p2q88576vp | contributor_item | Submission 8576VP | false | import csv, io, json
def transform(text):
rows = csv.DictReader(io.StringIO(text.strip()), delimiter="\t")
out = {}
for r in rows:
out.setdefault(r["region"], {})
out[r["region"]][r["product"]] = out[r["region"]].get(r["product"], 0) + int(r["revenue"])
ordered = {rg: {p: out[rg][p] for... | region product revenue
north A 120
south A 90
north B 75
south B 140
north A 30 | {
"north": {
"A": 150,
"B": 75
},
"south": {
"A": 90,
"B": 140
}
} | Aggregate TSV revenue by region and product and return nested JSON sorted by region then product. | null | null | null |
cmsrb1sp1000be0p2nvkiejip | contributor_item | Submission KIEJIP | false | import csv, io, json
def transform(text):
rows = csv.DictReader(io.StringIO(text.strip()))
out = []
for r in rows:
total = int(r["qty"]) * float(r["unit_price"]) * (1 - float(r["discount_pct"]) / 100)
out.append({"item": r["item"], "total": round(total, 2)})
return json.dumps(out, separ... | item,qty,unit_price,discount_pct
A,2,10.00,0
B,1,25.00,20
C,3,4.00,10 | [
{
"item": "A",
"total": 20
},
{
"item": "B",
"total": 20
},
{
"item": "C",
"total": 10.8
}
] | Compute each CSV line's discounted total and return a compact JSON array with item and total rounded to two decimals. | null | null | null |
cmsrb1sp10005e0p25m1g8j1g | contributor_item | Submission 1G8J1G | false | import json, re
def transform(text):
out = {}
for part in text.strip().split(";"):
if not part.strip():
continue
k, v = [x.strip() for x in part.split("=", 1)]
if v.lower() in ("true", "false"):
val = v.lower() == "true"
elif re.fullmatch(r"-?\d+", v):
... | id = 7 ; name = Ada Lovelace ; active = TRUE ; score = 98.5 | {
"id": 7,
"name": "Ada Lovelace",
"active": true,
"score": 98.5
} | Parse semicolon-separated key=value pairs, trim whitespace, coerce integer/float/boolean values, and return compact JSON. | null | null | null |
cmsrb1sp1000oe0p2i1gafdpc | contributor_item | Submission GAFDPC | false | import json
from datetime import date
def transform(text):
d = json.loads(text)
asof = date.fromisoformat(d["as_of"])
out = {}
for p in d["people"]:
b = date.fromisoformat(p["birth"])
age = asof.year - b.year - ((asof.month, asof.day) < (b.month, b.day))
out[p["name"]] = age
... | {"people":[{"name":"Ana","birth":"2000-02-29"},{"name":"Ben","birth":"1995-12-31"},{"name":"Cy","birth":"2004-08-13"}],"as_of":"2026-08-13"} | {
"Ana": 26,
"Ben": 30,
"Cy": 22
} | Compute each person's integer age as of the supplied ISO date and return a compact JSON object keyed by name. | null | null | null |
cmsrb1sp10008e0p228l47gpx | contributor_item | Submission L47GPX | false | def transform(text):
totals = {}
for line in text.strip().splitlines():
k, v = line.split(":")
totals[k] = totals.get(k, 0) + int(v)
pairs = sorted(totals.items(), key=lambda kv: (-kv[1], kv[0]))
return "\n".join(f"{k}={v}" for k, v in pairs)
| alpha:3
beta:1
alpha:2
gamma:5
beta:4 | "alpha=5\nbeta=5\ngamma=5" | Sum colon-separated integer values by key, then return lines sorted by descending total and key as `key=total`. | null | null | null |
cmsrb1sp1000pe0p22na91f3b | contributor_item | Submission A91F3B | false | import json
def transform(text):
out = {}
for line in text.strip().splitlines():
fields = dict(part.split("=", 1) for part in line.split())
h = fields["host"]
status = int(fields["status"])
size = int(fields["bytes"])
a = out.setdefault(h, {"requests": 0, "bytes": 0, "er... | host=a.example.com status=200 bytes=120
host=b.example.com status=500 bytes=30
host=a.example.com status=200 bytes=80
host=b.example.com status=200 bytes=70 | {
"a.example.com": {
"requests": 2,
"bytes": 200,
"errors": 0
},
"b.example.com": {
"requests": 2,
"bytes": 100,
"errors": 1
}
} | Parse space-separated key=value log fields and return compact JSON per host with request count, total bytes, and error count for status >= 400. | null | null | null |
cmsrb1sp10007e0p2k0ew58di | contributor_item | Submission EW58DI | false | import json, statistics
def transform(text):
vals = [x for x in json.loads(text)["readings"] if x is not None]
return json.dumps({"count": len(vals), "min": min(vals), "max": max(vals), "median": statistics.median(vals)}, separators=(",", ":"))
| {"readings":[3,null,7,12,null,5,18]} | {
"count": 5,
"min": 3,
"max": 18,
"median": 7
} | From the JSON readings array, ignore nulls and return JSON with count, min, max, and median. | null | null | null |
cmsrb1sp10009e0p2db0dmprr | contributor_item | Submission 0DMPRR | false | import json
def transform(text):
counts = {}
for u in json.loads(text)["users"]:
for t in u["tags"]:
counts[t] = counts.get(t, 0) + 1
ordered = dict(sorted(counts.items(), key=lambda kv: (-kv[1], kv[0])))
return json.dumps(ordered, separators=(",", ":"))
| {"users":[{"name":"Nia","tags":["ml","python"]},{"name":"Omar","tags":["python","sql"]},{"name":"Pia","tags":[]},{"name":"Raj","tags":["ml","sql","python"]}]} | {
"python": 3,
"ml": 2,
"sql": 2
} | Count tag frequencies across all users and return compact JSON sorted by descending count then tag name. | null | null | null |
cmsrb1sp1000qe0p2znmbv185 | contributor_item | Submission MBV185 | false | import json
def transform(text):
d = json.loads(text)
vals, w = d["values"], d["window"]
sums = [sum(vals[i:i+w]) for i in range(len(vals)-w+1)]
return json.dumps({"window_sums": sums, "max_sum": max(sums)}, separators=(",", ":"))
| {"values":[4,9,16,25,36],"window":3} | {
"window_sums": [
29,
50,
77
],
"max_sum": 77
} | Compute sliding-window sums of the given width and return compact JSON with the sums and the maximum sum. | null | null | null |
cmsrb1sp1000ee0p2ze3qxmji | contributor_item | Submission 3QXMJI | false | import json
def transform(text):
out = {}
for line in text.strip().splitlines():
k, v = line.split(":", 1)
k, v = k.strip(), v.strip()
if "," in v:
val = sorted(set(x.strip() for x in v.split(",") if x.strip()))
elif v.lower() in ("yes", "no"):
val = v.lo... | name: Ada
skills: python, math, python
active: yes
age: 37 | {
"name": "Ada",
"skills": [
"math",
"python"
],
"active": true,
"age": 37
} | Parse simple `key: value` lines; convert comma-separated values to a deduplicated sorted list, yes/no to booleans, integers to numbers, and return compact JSON. | null | null | null |
cmsrb1sp10004e0p22mhutzfx | contributor_item | Submission HUTZFX | false | import json
def transform(text):
data = json.loads(text)["events"]
agg = {}
for e in data:
a = agg.setdefault(e["type"], {"total": 0, "successful": 0})
a["total"] += 1
a["successful"] += int(bool(e["ok"]))
out = {}
for k in sorted(agg):
a = agg[k]
out[k] = {"... | {"events":[{"type":"click","ok":true},{"type":"click","ok":false},{"type":"purchase","ok":true},{"type":"click","ok":true},{"type":"purchase","ok":false}]} | {
"click": {
"total": 3,
"successful": 2,
"success_rate": 0.67
},
"purchase": {
"total": 2,
"successful": 1,
"success_rate": 0.5
}
} | Group events by type and return JSON with total count, successful count, and success_rate rounded to two decimals for each type. | null | null | null |
cmsrb1sp2000ue0p2rf6tmagk | contributor_item | Submission 6TMAGK | false | import json
def transform(text):
scores = json.loads(text)["scores"]
avgs = {k: round(sum(v)/len(v), 2) for k, v in sorted(scores.items())}
best = sorted(avgs, key=lambda k: (-avgs[k], k))[0]
return json.dumps({"averages": avgs, "best_question": best}, separators=(",", ":"))
| {"scores":{"q1":[8,7,9],"q2":[10,6,8],"q3":[5,9,7]}} | {
"averages": {
"q1": 8,
"q2": 8,
"q3": 7
},
"best_question": "q1"
} | For each question, compute its average score and return compact JSON with per-question averages plus the question with the highest average; break ties lexicographically. | null | null | null |
cmsrb1sp1000ne0p2cwxgypu0 | contributor_item | Submission XGYPU0 | false | def transform(text):
totals = {}
for line in text.strip().splitlines():
k, v = line.split(",")
totals[k] = totals.get(k, 0) + int(v)
rows = sorted(totals.items(), key=lambda kv: (-kv[1], kv[0]))
return "item,quantity\n" + "\n".join(f"{k},{v}" for k, v in rows)
| apple,10
banana,7
apple,-2
orange,5
banana,3
orange,-1 | "item,quantity\nbanana,10\napple,8\norange,4" | Apply signed quantity adjustments by item and return CSV with header item,quantity sorted by descending final quantity then item name. | null | null | null |
cmsrb1sp10003e0p2qa3oviw0 | contributor_item | Submission 3OVIW0 | false | import json
def transform(text):
users = {}
for line in text.strip().splitlines():
user, roles = line.split("|", 1)
users.setdefault(user, set()).update(r for r in roles.split(",") if r)
out = {u: sorted(users[u]) for u in sorted(users)}
return json.dumps(out, separators=(",", ":"))
| alice|admin,editor
bob|viewer
carol|editor,viewer
alice|viewer | {
"alice": [
"admin",
"editor",
"viewer"
],
"bob": [
"viewer"
],
"carol": [
"editor",
"viewer"
]
} | Parse user|comma-separated-roles lines, merge duplicate users, deduplicate roles, sort roles alphabetically, and return JSON keyed by username. | null | null | null |
cmsrb1sp1000ke0p2lsjcvjs5 | contributor_item | Submission JCVJS5 | false | import json
def transform(text):
out = []
for line in text.strip().splitlines():
i, n, p, a = line.split("|")
out.append({"id": int(i), "name": n, "price": float(p), "active": a.lower() == "true"})
return json.dumps(out, separators=(",", ":"))
| 001|Widget A|12.50|true
002|Widget B|0|false
003|Widget C|7.25|true | [
{
"id": 1,
"name": "Widget A",
"price": 12.5,
"active": true
},
{
"id": 2,
"name": "Widget B",
"price": 0,
"active": false
},
{
"id": 3,
"name": "Widget C",
"price": 7.25,
"active": true
}
] | Parse pipe-delimited product rows and return compact JSON array coercing id to integer, price to float, and active to boolean. | null | null | null |
cmsrb1sp1000ge0p2flcyxm9o | contributor_item | Submission CYXM9O | false | import json
def transform(text):
d = json.loads(text)
out = {}
for r in d["records"]:
if r["value"] < d["threshold"]:
continue
a = out.setdefault(r["category"], {"count": 0, "sum": 0})
a["count"] += 1
a["sum"] += r["value"]
ordered = {k: out[k] for k in sorte... | {"records":[{"category":"x","value":5},{"category":"y","value":2},{"category":"x","value":11},{"category":"y","value":8},{"category":"z","value":4}],"threshold":5} | {
"x": {
"count": 2,
"sum": 16
},
"y": {
"count": 1,
"sum": 8
}
} | Filter records to values at least threshold, then return JSON counts and sums by category. | null | null | null |
cmsrb1sp1000he0p2cnertq0c | contributor_item | Submission ERTQ0C | false | import json
def transform(text):
sums, counts = {}, {}
for line in text.strip().splitlines():
_, p, r = line.split(",")
sums[p] = sums.get(p, 0) + int(r)
counts[p] = counts.get(p, 0) + 1
out = {p: round(sums[p] / counts[p], 2) for p in sorted(sums)}
return json.dumps(out, separa... | u1,p1,4
u1,p2,5
u2,p1,2
u2,p3,5
u3,p2,3 | {
"p1": 3,
"p2": 4,
"p3": 5
} | Parse user,product,rating rows and return JSON with average rating per product rounded to two decimals, sorted by product. | null | null | null |
cmsrb1sp1000ie0p21i761tfd | contributor_item | Submission 761TFD | false | import json, re
def transform(text):
d = json.loads(text)
stop = {s.lower() for s in d["stop"]}
counts = {}
for w in re.findall(r"[A-Za-z]+", d["text"].lower()):
if w in stop:
continue
counts[w] = counts.get(w, 0) + 1
ordered = dict(sorted(counts.items(), key=lambda kv: ... | {"text":"Red fish, blue fish; red bird. BLUE bird!","stop":["fish"]} | {
"bird": 2,
"blue": 2,
"red": 2
} | Tokenize alphabetic words case-insensitively, remove stop words, count remaining words, and return compact JSON sorted by descending frequency then alphabetically. | null | null | null |
cmsrb1sp2000se0p242p00f15 | contributor_item | Submission P00F15 | false | import json
def transform(text):
paths = json.loads(text)["paths"]
counts = {}
for p in paths:
seg = [s for s in p.split("/") if s]
key = "/" + "/".join(seg[:2])
counts[key] = counts.get(key, 0) + 1
return json.dumps(dict(sorted(counts.items())), separators=(",", ":"))
| {"paths":["/api/users","/api/users/42","/api/orders/7","/health","/api/orders/9/items"]} | {
"/api/orders": 2,
"/api/users": 2,
"/health": 1
} | Group URL paths by their first two non-empty segments (or the entire shorter path), count them, and return compact JSON sorted by group key. | null | null | null |
cmsrb1sp1000ce0p2xtv0bozt | contributor_item | Submission V0BOZT | false | import json
def transform(text):
out = {}
for line in text.strip().splitlines():
ip, method, path, status = line.split()
klass = status[0] + "xx"
if klass not in ("2xx", "4xx", "5xx"):
continue
out.setdefault(ip, {})
out[ip][klass] = out[ip].get(klass, 0) + 1... | 10.0.0.1 GET /a 200
10.0.0.2 POST /b 500
10.0.0.1 GET /c 404
10.0.0.1 POST /d 201
10.0.0.2 GET /e 200 | {
"10.0.0.1": {
"2xx": 2,
"4xx": 1
},
"10.0.0.2": {
"2xx": 1,
"5xx": 1
}
} | Parse space-separated log rows and return JSON mapping IP to counts of 2xx, 4xx, and 5xx responses, omitting zero-valued classes. | null | null | null |
cmsrb1sp1000fe0p2s54c5i0l | contributor_item | Submission 4C5I0L | false | import json
def transform(text):
rows = []
for line in text.strip().splitlines():
d, v = line.split(",")
rows.append((d, int(v)))
deltas = [{"date": rows[i][0], "delta": rows[i][1] - rows[i-1][1]} for i in range(1, len(rows))]
best = max(deltas, key=lambda x: x["delta"])["date"]
ret... | 2026-08-01,12
2026-08-02,15
2026-08-03,9
2026-08-04,18
2026-08-05,21 | {
"deltas": [
{
"date": "2026-08-02",
"delta": 3
},
{
"date": "2026-08-03",
"delta": -6
},
{
"date": "2026-08-04",
"delta": 9
},
{
"date": "2026-08-05",
"delta": 3
}
],
"max_increase_date": "2026-08-04"
} | Convert date,value rows into JSON containing day-over-day deltas starting from the second day and the maximum increase date. | null | null | null |
cmsrb1sp1000de0p2h21ktsdl | contributor_item | Submission 1KTSDL | false | import json
def transform(text):
m = json.loads(text)["matrix"]
t = [list(col) for col in zip(*m)]
n = len(m)
return json.dumps({"transpose": t, "main_diagonal": sum(m[i][i] for i in range(n)), "anti_diagonal": sum(m[i][n-1-i] for i in range(n))}, separators=(",", ":"))
| {"matrix":[[1,2,3],[4,5,6],[7,8,9]]} | {
"transpose": [
[
1,
4,
7
],
[
2,
5,
8
],
[
3,
6,
9
]
],
"main_diagonal": 15,
"anti_diagonal": 15
} | Transpose the rectangular matrix in the JSON input and return compact JSON containing the transposed matrix and both diagonal sums of the original. | null | null | null |
cmsrb1sp10002e0p2yy50yf4u | contributor_item | Submission 50YF4U | false | import json
def transform(text):
sums, counts = {}, {}
for line in text.strip().splitlines():
_, service, ms = line.split(",")
sums[service] = sums.get(service, 0) + int(ms)
counts[service] = counts.get(service, 0) + 1
out = {k: round(sums[k] / counts[k], 1) for k in sorted(sums)}
... | 2026-08-01,api,120
2026-08-01,worker,80
2026-08-02,api,150
2026-08-02,worker,110
2026-08-02,api,30 | {
"api": 100,
"worker": 95
} | Parse date,service,milliseconds rows and return JSON with average latency per service rounded to one decimal. | null | null | null |
cmsrb1sp1000je0p224t5lheu | contributor_item | Submission T5LHEU | false | import csv, io, json
def transform(text):
out = {}
for r in csv.DictReader(io.StringIO(text.strip())):
out.setdefault(r["team"], {})
out[r["team"]][r["member"]] = out[r["team"]].get(r["member"], 0) + int(r["hours"])
ordered = {t: {m: out[t][m] for m in sorted(out[t])} for t in sorted(out)}
... | team,member,hours
A,Lee,3
A,Sam,5
B,Ira,4
A,Lee,2
B,Ira,1
B,Moe,6 | {
"A": {
"Lee": 5,
"Sam": 5
},
"B": {
"Ira": 5,
"Moe": 6
}
} | Aggregate CSV hours first by team then member and return nested compact JSON with members sorted alphabetically. | null | null | null |
cmsrb1sp1000me0p2h97lb266 | contributor_item | Submission 7LB266 | false | import json
def transform(text):
tx = json.loads(text)["transactions"]
bal = {}
for t in tx:
bal[t["acct"]] = bal.get(t["acct"], 0) + t["amount"]
bal = dict(sorted(bal.items()))
pos = [k for k, v in bal.items() if v > 0]
return json.dumps({"balances": bal, "positive_accounts": pos}, sep... | {"transactions":[{"acct":"A","amount":10},{"acct":"B","amount":-4},{"acct":"A","amount":7},{"acct":"B","amount":9},{"acct":"C","amount":0}]} | {
"balances": {
"A": 17,
"B": 5,
"C": 0
},
"positive_accounts": [
"A",
"B"
]
} | Compute net transaction amount per account and return compact JSON containing balances plus positive-account names sorted alphabetically. | null | null | null |
cmsrb1sp00000e0p228glhqui | contributor_item | Submission GLHQUI | false | import json
def transform(text):
data = json.loads(text)
lines = [{"id": o["id"], "line_total": o["qty"] * o["price"]} for o in data["orders"]]
grand = sum(x["line_total"] for x in lines)
top = max(lines, key=lambda x: x["line_total"])["id"]
return json.dumps({"grand_total": grand, "highest_value_o... | {"orders":[{"id":"A1","qty":2,"price":12.5},{"id":"A2","qty":1,"price":30},{"id":"A3","qty":4,"price":5.25}]} | {
"grand_total": 76,
"highest_value_order": "A2"
} | Parse the JSON order list, compute each line total, and return JSON containing the grand total and the id of the highest-value line. | null | null | null |
cmsrb1sp10001e0p2myd4r7t7 | contributor_item | Submission D4R7T7 | false | import csv, io, json
def transform(text):
rows = csv.DictReader(io.StringIO(text.strip()))
totals = {}
for r in rows:
totals[r["sku"]] = totals.get(r["sku"], 0) + int(r["stock"])
return json.dumps(dict(sorted(totals.items())), separators=(",", ":"))
| sku,warehouse,stock
P1,EAST,4
P1,WEST,7
P2,EAST,0
P2,WEST,3
P3,EAST,5 | {
"P1": 11,
"P2": 3,
"P3": 5
} | Aggregate CSV inventory by SKU and return a JSON object mapping each SKU to total stock, sorted by SKU. | null | null | null |
cmsrb1sp1000le0p29b68xxv9 | contributor_item | Submission 68XXV9 | false | import json
def transform(text):
ranges = sorted(json.loads(text)["ranges"])
merged = []
for a, b in ranges:
if not merged or a > merged[-1][1] + 1:
merged.append([a, b])
else:
merged[-1][1] = max(merged[-1][1], b)
return json.dumps(merged, separators=(",", ":"))... | {"ranges":[[1,4],[3,7],[10,12],[11,15],[20,20]]} | [
[
1,
7
],
[
10,
15
],
[
20,
20
]
] | Merge overlapping or touching integer ranges and return the merged ranges as compact JSON. | null | null | null |
cmsrb1sp1000ae0p2adnsvd0x | contributor_item | Submission NSVD0X | false | import json
from datetime import datetime
def transform(text):
out = {}
for line in text.strip().splitlines():
ts, event = line.split(",", 1)
hour = datetime.fromisoformat(ts.replace("Z", "+00:00")).strftime("%H")
out.setdefault(hour, {})
out[hour][event] = out[hour].get(event, ... | 2026-08-01T10:00:00Z,login
2026-08-01T10:05:00Z,logout
2026-08-01T11:00:00Z,login
2026-08-01T11:15:00Z,login | {
"10": {
"login": 1,
"logout": 1
},
"11": {
"login": 2
}
} | Count event names per UTC hour and return JSON keyed by hour with nested event counts. | null | null | null |
cmsrb1sp1000re0p2ybsjvgdh | contributor_item | Submission SJVGDH | false | import csv, io
def transform(text):
rows = list(csv.DictReader(io.StringIO(text.strip())))
rows.sort(key=lambda r: (int(r["priority"]), r["title"]))
return "priority,title\n" + "\n".join(f'{r["priority"]},{r["title"]}' for r in rows)
| priority,title
2,fix docs
1,deploy
3,refactor
1,backup
2,test | "priority,title\n1,backup\n1,deploy\n2,fix docs\n2,test\n3,refactor" | Sort CSV tasks by ascending numeric priority then title and return a normalized CSV string with the same header. | null | null | null |
cmsrb1sp2000te0p2ka8wqnpr | contributor_item | Submission 8WQNPR | false | import json
def transform(text):
out = {}
for line in text.strip().splitlines():
email, role = line.split(",", 1)
out.setdefault(email.lower(), set()).add(role)
ordered = {e: sorted(out[e]) for e in sorted(out)}
return json.dumps(ordered, separators=(",", ":"))
| alice@example.com,Admin
ALICE@example.com,Editor
bob@example.com,Viewer
Bob@Example.com,Viewer | {
"alice@example.com": [
"Admin",
"Editor"
],
"bob@example.com": [
"Viewer"
]
} | Normalize email addresses to lowercase, merge duplicate rows, deduplicate roles case-sensitively, and return compact JSON keyed by normalized email with sorted roles. | null | null | null |
cmsrb6z9y0014e0p2azs0h58r | contributor_item | Submission S0H58R | false | import json
def transform(text):
c={}
for p in json.loads(text)["paths"]:
k=p.split("/")[0];c[k]=c.get(k,0)+1
return json.dumps(dict(sorted(c.items())),separators=(",",":"))
| {"paths":["a/b/c","a/b/d","a/x","z"]} | {
"a": 3,
"z": 1
} | Count JSON slash-delimited paths by first segment and return compact JSON sorted by segment. | null | null | null |
cmsrb6z9y0015e0p2cr50toe7 | contributor_item | Submission 50TOE7 | false | import json
def transform(text):
out={}
for line in text.strip().splitlines():
k,vals=line.split(":");out[k]=sum(map(int,vals.split(",")))
return json.dumps(out,separators=(",",":"))
| A:1,3,5
B:2,4
C:10 | {
"A": 9,
"B": 6,
"C": 10
} | Parse label:comma-separated-integers lines and return compact JSON mapping each label to the sum of its values. | null | null | null |
cmsrb6z9y0016e0p20e3mekuk | contributor_item | Submission 3MEKUK | false | import json
def transform(text):
c={}
for r in json.loads(text)["rows"]:
if r["active"]:c[r["dept"]]=c.get(r["dept"],0)+1
return json.dumps(dict(sorted(c.items())),separators=(",",":"))
| {"rows":[{"dept":"eng","active":true},{"dept":"sales","active":false},{"dept":"eng","active":true},{"dept":"sales","active":true}]} | {
"eng": 2,
"sales": 1
} | Count only active JSON rows by department and return compact JSON sorted by department. | null | null | null |
cmsrb6z9y0017e0p258fy0t7v | contributor_item | Submission FY0T7V | false | import json
def transform(text):
a=list(map(int,text.strip().splitlines()))
return json.dumps({"first":a[0],"last":a[-1],"change":a[-1]-a[0]},separators=(",",":"))
| 10
15
12
12
20 | {
"first": 10,
"last": 20,
"change": 10
} | Convert newline-separated integers into compact JSON containing the first value, last value, and net change. | null | null | null |
cmsrb6z9y001ae0p2o73inrma | contributor_item | Submission 3INRMA | false | import json
def transform(text):
out={}
for k,v in json.loads(text)["pairs"]:out[k]=out.get(k,0)+v
return json.dumps(dict(sorted(out.items())),separators=(",",":"))
| {"pairs":[["a",1],["b",2],["a",3]]} | {
"a": 4,
"b": 2
} | Fold JSON key/value pairs into an object by summing repeated keys and return compact JSON sorted by key. | null | null | null |
cmsrb6z9y001de0p2573rayco | contributor_item | Submission 3RAYCO | false | import json
def transform(text):
keys=[]
for line in text.strip().splitlines():
k,v=line.split("=")
if v.lower()=="true":keys.append(k)
return json.dumps(sorted(keys),separators=(",",":"))
| a=true
b=false
c=TRUE
d=False | [
"a",
"c"
] | Parse key=boolean lines case-insensitively and return compact JSON listing enabled keys alphabetically. | null | null | null |
cmsrb6z9y000ve0p2vxrcntcs | contributor_item | Submission RCNTCS | false | import json
def transform(text):
vals=json.loads(text)["values"]
c={}
for v in vals:c[v]=c.get(v,0)+1
return json.dumps({str(k):c[k] for k in sorted(c)},separators=(",",":"))
| {"values":[2,5,2,9,5,2]} | {
"2": 3,
"5": 2,
"9": 1
} | Count each integer in the JSON values array and return compact JSON keyed by the number as a string, ordered numerically. | null | null | null |
cmsrb6z9y000we0p2pdgtvqrf | contributor_item | Submission GTVQRF | false | import csv,io,json
def transform(text):
d={}
for r in csv.DictReader(io.StringIO(text.strip())):d[r["name"]]=d.get(r["name"],0)+int(r["score"])
return json.dumps(dict(sorted(d.items())),separators=(",",":"))
| name,score
Ari,8
Bea,10
Ari,6
Cal,7
Bea,4 | {
"Ari": 14,
"Bea": 14,
"Cal": 7
} | Aggregate CSV scores by name and return compact JSON with each name’s total score, sorted alphabetically. | null | null | null |
cmsrb6z9y000ye0p267v9s67n | contributor_item | Submission V9S67N | false | import json
def transform(text):
c={}
for w in json.loads(text)["words"]:
w=w.lower();c[w]=c.get(w,0)+1
return json.dumps(dict(sorted(c.items(),key=lambda kv:(-kv[1],kv[0]))),separators=(",",":"))
| {"words":["Alpha","beta","ALPHA","Beta","gamma"]} | {
"alpha": 2,
"beta": 2,
"gamma": 1
} | Normalize words to lowercase, count frequencies, and return compact JSON ordered by descending count then word. | null | null | null |
cmsrb6z9y0013e0p2z3chj0df | contributor_item | Submission CHJ0DF | false | import csv,io,json
from decimal import Decimal
def transform(text):
out={}
for r in csv.DictReader(io.StringIO(text.strip())):out[r["sku"]]=int(Decimal(r["price"])*100)
return json.dumps(out,separators=(",",":"))
| sku,price
P1,12.50
P2,8.00
P3,20.00 | {
"P1": 1250,
"P2": 800,
"P3": 2000
} | Convert CSV prices to integer cents and return compact JSON mapping SKU to cents in input order. | null | null | null |
cmsrb6z9y0019e0p2z2xhjqzk | contributor_item | Submission XHJQZK | false | import json
def transform(text):
d={}
for line in text.strip().splitlines():
_,k,v=line.split("|");d[k]=d.get(k,0)+int(v)
return json.dumps(dict(sorted(d.items())),separators=(",",":"))
| u1|A|5
u2|B|3
u1|B|2
u3|A|4 | {
"A": 9,
"B": 5
} | Aggregate pipe-delimited points by category, ignoring user id, and return compact JSON sorted by category. | null | null | null |
cmsrb6z9y001be0p2izon6ytj | contributor_item | Submission ON6YTJ | false | import json
def transform(text):
d={}
for line in text.strip().splitlines():
k,v=line.split(",");d[k]=d.get(k,0)+int(v)
k=sorted(d,key=lambda x:(-d[x],x))[0]
return json.dumps({"key":k,"total":d[k]},separators=(",",":"))
| x,2
y,5
x,4
z,1 | {
"key": "x",
"total": 6
} | Parse key,value rows and return compact JSON with the key having the highest total and that total; break ties alphabetically. | null | null | null |
cmsrb6z9y001ee0p211b9doo7 | contributor_item | Submission B9DOO7 | false | import json
def transform(text):
s=0;out=[]
for v in json.loads(text)["values"]:
s+=v;out.append(s)
return json.dumps(out,separators=(",",":"))
| {"values":[2,4,6,8]} | [
2,
6,
12,
20
] | Return compact JSON with the cumulative sums of the input values. | null | null | null |
cmsrb6z9y001ce0p23yepfggz | contributor_item | Submission EPFGGZ | false | import json
def transform(text):
r=sorted(json.loads(text)["records"],key=lambda x:x["id"])
return json.dumps([x["name"] for x in r],separators=(",",":"))
| {"records":[{"id":3,"name":"C"},{"id":1,"name":"A"},{"id":2,"name":"B"}]} | [
"A",
"B",
"C"
] | Sort JSON records by numeric id ascending and return a compact JSON array of names only. | null | null | null |
cmsrb6z9y001ge0p217rya70n | contributor_item | Submission RYA70N | false | import json
def transform(text):
seen=set();out=[]
for x in json.loads(text)["values"]:
if x not in seen:seen.add(x);out.append(x)
return json.dumps(out,separators=(",",":"))
| {"values":[5,1,5,2,1,3]} | [
5,
1,
2,
3
] | Remove duplicate integers while preserving first occurrence order and return a compact JSON array. | null | null | null |
cmsrb6z9z001ke0p25a5xime3 | contributor_item | Submission 5XIME3 | false | import json
def transform(text):
rows=json.loads(text)["rows"]
return json.dumps([sum(col) for col in zip(*rows)],separators=(",",":"))
| {"rows":[[1,2,3],[4,5,6]]} | [
5,
7,
9
] | Compute column sums for the rectangular JSON rows matrix and return them as a compact JSON array. | null | null | null |
cmsrb6z9y0018e0p2y7wwx8xc | contributor_item | Submission WWX8XC | false | import json
def transform(text):
d=json.loads(text)
return json.dumps(sorted(x for x in d["values"] if x>d["threshold"]),separators=(",",":"))
| {"values":[3,8,1,9,4],"threshold":4} | [
8,
9
] | Filter values strictly above the JSON threshold, sort ascending, and return them as a compact JSON array. | null | null | null |
cmsrb6z9y0011e0p2zrk368l3 | contributor_item | Submission K368L3 | false | def transform(text):
d={}
for line in text.strip().splitlines():
k,v=line.split("|");d[k]=d.get(k,0)+int(v)
return "\n".join(f"{k}:{v}" for k,v in sorted(d.items(),key=lambda kv:(-kv[1],kv[0])))
| red|4
blue|1
red|3
green|2 | "red:7\ngreen:2\nblue:1" | Sum pipe-delimited quantities by color and return lines as color:total sorted by descending total then color. | null | null | null |
cmsrb6z9z001he0p2f7a2aeab | contributor_item | Submission A2AEAB | false | import json
def transform(text):
out={}
for line in text.strip().splitlines():
p,q,price=line.split(":");out[p]=int(q)*int(price)
return json.dumps(dict(sorted(out.items())),separators=(",",":"))
| P1:4:10
P2:2:25
P3:5:3 | {
"P1": 40,
"P2": 50,
"P3": 15
} | Parse product:quantity:unit_price rows and return compact JSON mapping each product to line revenue, sorted by product. | null | null | null |
cmsrb6z9y001fe0p2tc3ad1l6 | contributor_item | Submission 3AD1L6 | false | import csv,io,json
def transform(text):
d={}
for r in csv.DictReader(io.StringIO(text.strip())):
t=int(r["temp"]);d[r["city"]]=max(t,d.get(r["city"],t))
return json.dumps(dict(sorted(d.items())),separators=(",",":"))
| city,temp
Delhi,32
Mumbai,29
Delhi,35
Mumbai,31 | {
"Delhi": 35,
"Mumbai": 31
} | Compute maximum temperature per city from CSV and return compact JSON sorted by city. | null | null | null |
cmsrb6z9z001ie0p2l0pbfy71 | contributor_item | Submission PBFY71 | false | import json
def transform(text):
g=json.loads(text)["groups"]
return json.dumps({k:len(v) for k,v in sorted(g.items()) if v},separators=(",",":"))
| {"groups":{"a":[1,2],"b":[3],"c":[]}} | {
"a": 2,
"b": 1
} | Return compact JSON mapping each group to its item count and omit empty groups. | null | null | null |
cmsrb6z9z001je0p23m8g3nue | contributor_item | Submission 8G3NUE | false | import json
def transform(text):
d={}
for w in text.split():d[w]=d.get(w,0)+1
return json.dumps(dict(sorted(d.items())),separators=(",",":"))
| alpha beta alpha
gamma beta
alpha | {
"alpha": 3,
"beta": 2,
"gamma": 1
} | Count whitespace-delimited tokens across all lines and return compact JSON sorted alphabetically. | null | null | null |
cmsrb6z9z001le0p2eg5l12ph | contributor_item | Submission 5L12PH | false | import csv,io,json
def transform(text):
d={}
for r in csv.DictReader(io.StringIO(text.strip())):d[r["status"]]=d.get(r["status"],0)+1
return json.dumps(dict(sorted(d.items())),separators=(",",":"))
| id,status
1,open
2,closed
3,open
4,pending
5,closed | {
"closed": 2,
"open": 2,
"pending": 1
} | Count CSV rows by status and return compact JSON sorted by status. | null | null | null |
cmsrb6z9y000ze0p2p4mc1q4y | contributor_item | Submission MC1Q4Y | false | import json
def transform(text):
rows=[(d,int(v)) for d,v in (line.split(",") for line in text.strip().splitlines())]
mn=min(rows,key=lambda x:x[1]);mx=max(rows,key=lambda x:x[1])
return json.dumps({"min":{"date":mn[0],"value":mn[1]},"max":{"date":mx[0],"value":mx[1]}},separators=(",",":"))
| 2026-08-01,4
2026-08-02,7
2026-08-03,5
2026-08-04,10 | {
"min": {
"date": "2026-08-01",
"value": 4
},
"max": {
"date": "2026-08-04",
"value": 10
}
} | Parse date,value lines and return compact JSON with the minimum value, maximum value, and dates where they occur. | null | null | null |
cmsrb6z9z001me0p2jqiy3nvw | contributor_item | Submission IY3NVW | false | import json
def transform(text):
a=json.loads(text)["nums"]
return json.dumps({"negative":sum(x<0 for x in a),"zero":sum(x==0 for x in a),"positive":sum(x>0 for x in a)},separators=(",",":"))
| {"nums":[-3,0,4,-1,2]} | {
"negative": 2,
"zero": 1,
"positive": 2
} | Return compact JSON with counts of negative, zero, and positive numbers. | null | null | null |
cmsrb6z9y000xe0p2c226z283 | contributor_item | Submission 26Z283 | false | import json
def transform(text):
out={}
for part in text.split(";"):
k,v=part.split("=");v=int(v)
if v>0 and v%2:out[k]=v
return json.dumps(out,separators=(",",":"))
| a=3;b=8;c=-2;d=5 | {
"a": 3,
"d": 5
} | Parse semicolon-separated integer assignments and return compact JSON containing only entries with positive odd values, preserving key order. | null | null | null |
cmsrb6z9y0010e0p2ci2gv4x2 | contributor_item | Submission 2GV4X2 | false | import json
def transform(text):
out={}
for r in json.loads(text)["items"]:out[r["k"]]=out.get(r["k"],1)*r["v"]
return json.dumps(dict(sorted(out.items())),separators=(",",":"))
| {"items":[{"k":"x","v":2},{"k":"y","v":3},{"k":"x","v":4}]} | {
"x": 8,
"y": 3
} | Group JSON items by k, multiply values within each group, and return compact JSON sorted by key. | null | null | null |
cmsrb6z9y0012e0p2ychno9lm | contributor_item | Submission HNO9LM | false | import json
def transform(text):
a=json.loads(text)["nums"]
return json.dumps({"even":[x for x in a if x%2==0],"odd":[x for x in a if x%2]},separators=(",",":"))
| {"nums":[1,2,3,4,5,6]} | {
"even": [
2,
4,
6
],
"odd": [
1,
3,
5
]
} | Partition the JSON nums array into even and odd arrays and return compact JSON with evens first. | null | null | null |
cmsrb6z9z001ne0p28zc019sl | contributor_item | Submission C019SL | false | import json
def transform(text):
total=0
for line in text.strip().splitlines():
s,w=line.split("|");total+=len(s)*int(w)
return json.dumps({"weighted_chars":total},separators=(",",":"))
| aa|3
bbb|4
c|5 | {
"weighted_chars": 23
} | Parse token|weight lines and return compact JSON with total weighted character count, defined as len(token)*weight summed across rows. | null | null | null |
cmsrb6z9z001oe0p260xhnjhf | contributor_item | Submission XHNJHF | false | import json
def transform(text):
r=sorted(json.loads(text)["items"],key=lambda x:(-x["score"],x["name"]))[0]
return json.dumps({"name":r["name"],"score":r["score"]},separators=(",",":"))
| {"items":[{"name":"a","score":7},{"name":"b","score":9},{"name":"c","score":9}]} | {
"name": "b",
"score": 9
} | Select the highest-scoring item from JSON, breaking ties by name alphabetically, and return compact JSON with name and score. | null | null | null |
cmsrbolnn003ke0p25wwfnul9 | contributor_item | Submission WFNUL9 | false | import json
def transform(text):
nums = json.loads(text)
n = len(nums)
total = sum(nums)
s = sorted(nums)
mid = n // 2
median = s[mid] if n % 2 == 1 else (s[mid - 1] + s[mid]) / 2
return json.dumps({"count": n, "sum": total, "mean": round(total / n, 2), "min": s[0], "max": s[-1], "median": ... | [4, 8, 15, 16, 23, 42] | {
"count": 6,
"sum": 108,
"mean": 18,
"min": 4,
"max": 42,
"median": 15.5
} | Compute descriptive statistics (count, sum, mean, min, max, median) for a JSON array of numbers and return them as a JSON object. | null | null | null |
cmsrbolnn003ge0p2al45pm6c | contributor_item | Submission 45PM6C | false | import json
def transform(text):
data = json.loads(text)
flat = [item for sublist in data for item in sublist]
return json.dumps(flat) | [[1, 2, 3], [4, 5], [6, 7, 8, 9]] | [
1,
2,
3,
4,
5,
6,
7,
8,
9
] | Flatten a JSON array of arrays into a single JSON array containing all elements in order. | null | null | null |
cmsrbolnn003ne0p2a9nwbpz2 | contributor_item | Submission NWBPZ2 | false | import json, csv, io
def transform(text):
data = json.loads(text)
out = io.StringIO()
writer = csv.writer(out)
writer.writerow(['name', 'salary', 'bonus', 'total'])
for row in data:
bonus = round(row['salary'] * row['bonus_pct'])
total = row['salary'] + bonus
writer.writerow... | [{"name": "Alice", "salary": 75000, "bonus_pct": 0.1}, {"name": "Bob", "salary": 90000, "bonus_pct": 0.15}, {"name": "Carol", "salary": 60000, "bonus_pct": 0.08}] | "name,salary,bonus,total\r\nAlice,75000,7500,82500\r\nBob,90000,13500,103500\r\nCarol,60000,4800,64800" | Read a JSON array of employee records and output a CSV with headers name, salary, bonus, total. Bonus is salary * bonus_pct (rounded to integer). Total is salary + bonus. | null | null | null |
cmsrbolnn003qe0p2xjgrak2q | contributor_item | Submission GRAK2Q | false | import json
def transform(text):
data = json.loads(text)
seen = set()
result = []
for item in data:
if item not in seen:
seen.add(item)
result.append(item)
return json.dumps(result) | [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5] | [
3,
1,
4,
5,
9,
2,
6
] | Deduplicate a JSON array of integers, preserving the first occurrence of each value, and return the result as a JSON array. | null | null | null |
End of preview.
Python Data Transformation Scripts
Each item is a python data transformation scripts example providing Input sample, What the transform should do, Transformation script, Expected output. Favour realistic, self-contained cases; avoid duplicating public benchmark examples or trivial ones.
About
This dataset was produced by the DataBounty community and published here as part of an open, karma-only program.
- Contributor items exported: 1000
- Language: Python
- Framework: Community
- License: CC-BY-4.0
Contributors
- @advisorygopher
- @ajaysomavarapu
- @arun-ai-forge
- @benam2k
- @bhanu-n
- @bravebooby
- @combinedgoat
- @culturalturtle
- @directfly
- @dutchswan
- @famousgoose
- @gladiator
- @integralgoldfish
- @kailas
- @kumar-k
- @maheshk218
- @odysseus
- @pleasedgiraffe
- @raja
- @sparemockingbird
- @starlord
- @vamshi
- @vinodhsnair
Files
data/items.jsonl— the accepted dataset items (one JSON object per line).manifest.json— machine-readable provenance, license, and credit metadata.
- Downloads last month
- -