File size: 639 Bytes
c9ef990 9e7ea31 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import numpy as np
import pandas as pd
df = pd.read_json("data_set_50.json")
meme_attribute = {}
meme_filename = []
meme_list = []
for col in df.columns:
name = df.loc["filename", col]
name = name.replace(".jpg", "")
name = name.replace("High-Quality-", "")
attribute_tmp = df.loc["file_attributes", col]
if attribute_tmp == {}:
continue
attribute_str = attribute_tmp['image_label'].strip().strip('"')
cleaned_attribute = attribute_str.replace(',', '')
file_name = df.loc["filename", col]
meme_attribute[name] = cleaned_attribute
meme_filename.append(file_name)
meme_list.append(name) |