import pyarrow as pa | |
with pa.memory_map( | |
"graphs/out/57926662-ef6c-4d33-b456-aa79b8c0fc60/whisper_text.arrow", "r" | |
) as source: | |
df_w = pa.RecordBatchStreamReader(source).read_all() | |
with pa.memory_map( | |
"graphs/out/57926662-ef6c-4d33-b456-aa79b8c0fc60/saved_file.arrow", "r" | |
) as source: | |
df_i = pa.RecordBatchStreamReader(source).read_all() | |
df_w = df_w.to_pandas() | |
df_i = df_i.to_pandas() | |
df_i["origin"] = df_i["saved_file"].map(lambda x: x[0]["origin"]) | |
df_w["whisper_text"] = df_w["whisper_text"].map(lambda x: x[0]) | |
df = df_i.merge(df_w, on="trace_id") | |
print(df) | |
print(df.columns) | |
print(df.groupby(by=["trace_id", "origin"]).count()) | |
print(df.groupby(by=["whisper_text", "origin"]).count()) | |