public
Created

Simple example of converting tuples to a map

  • Download Gist
tupletomap.py
Python
1 2 3 4 5 6 7 8 9 10 11
@outputSchema("output:map[]")
def tupleToMap(inputs):
field_names = ["field1", "field2", "field3"]
result = {}
if len(field_names) == len(inputs):
for i in range(len(inputs)):
result[field_names[i]] = inputs[i]
return result

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.