import json
def parse_log(log):
feature = log[['index', 'player_id', 'giftID', 'offer_time']]
feature_dict = dict()
keys = json.loads(log['state'].iloc[0]).keys()
for key in keys:
feature_dict[key] = []
for line in log['state']:
data = json.loads(line)
for key in keys:
feature_dict[key].append(data[key])
for key in keys:
feature[key] = feature_dict[key]
return feature