MCPcopy Create free account
hub / github.com/apache/arrow / pivot

Function pivot

python/pyarrow/tests/test_udf.py:352–355  ·  view source on GitHub ↗
(ctx, k, v, c)

Source from the content-addressed store, hash-verified

350 Register a vector function that returns a struct array
351 """
352 def pivot(ctx, k, v, c):
353 df = pa.RecordBatch.from_arrays([k, v, c], names=['k', 'v', 'c']).to_pandas()
354 df_pivot = df.pivot(columns='c', values='v', index='k').reset_index()
355 return pa.RecordBatch.from_pandas(df_pivot).to_struct_array()
356
357 func_name = "y=pivot(x)"
358 doc = empty_udf_doc

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected