Many functional languages define flatMap
function which works like map
but can flatten returning values.
Spark/pyspark has it http://spark.apache.org/docs/latest/api/python/pyspark.html#pyspark.RDD.flatMap
what would be the best way to have it in dask? My code looks like this:
import dask.bag as db
import json
from tools import get_records
records = db.read_text(json_file).map(json.loads).map(get_records)
get_records
returns list of dicts. I just need to chain them into one sequence.