File size: 665 Bytes
38b2c59 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import pandas as pd
from pathlib import Path
df = pd.read_parquet("CIRR/test-00000-of-00001.parquet")
print (df.iloc[0].qry_text)
print (df.iloc[0].qry_img_path)
print (df.iloc[0].tgt_text)
print (df.iloc[0].tgt_img_path)
"""
for i in range(len(df)):
df.iloc[i].qry_text = df.iloc[i].qry_text[len("Find me an everyday image that matches the given caption:"):].strip()
assert len(df.iloc[i].tgt_text) == len(df.iloc[i].tgt_img_path)
for j in range(len(df.iloc[i].tgt_text)):
df.iloc[i].tgt_text[j] = ""
df.iloc[i].tgt_img_path[j] = str(Path("CIRR") / Path(df.iloc[i].tgt_img_path[j]).name)
"""
df.to_parquet("CIRR/modified.parquet")
|