File size: 720 Bytes
b98ffbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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())