<jupyter_start><jupyter_text><jupyter_code>tlst = []
for j in range(0,len(lst)):
    tlst.append(0)
tlst
len(lst)
for i in lst:
    ct = 0
    re = 0
    rev = 0
    for j in range(0, len(df)):
        if(df.category[j] == i):
            re = re + df.ratings[j]
            ct = ct + 1
    rev = re*1.0/ct
    rel.append(rev)
    totalrev.append(ct)
type(df.ratings[0])
rel = []
totalrev = []
rel
totalrev
place_counts = []
for i in lst:
    ct = 0
    place = []
    for j in range(0, len(df)):
        if(df.category[j] == i):
            place.append(df.place[j])
    place = np.asarray(place)
    ct = len(np.unique(place))
    place_counts.append(ct)
place_counts
place = df.place.unique()
type(place)
ls2 = [df.category, df.ratings]
dt = {'category':lst, 'avg_reating':rel, 'total_rev':totalrev}
dt
final_lst = []
for i in range(0, len(lst)):
    dt = {'category':lst[i], 'total_places':place_counts[i], 'avg_reating':rel[i], 'total_rev':totalrev[i]}
    final_lst.append(dt)
final_lst
df1 = pd.DataFrame(final_lst)
df1.to_excel('D://features.xlsx')
df<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17355371900826447, 'fraction_numerical': 0.014692378328741965, 'mean_word_length': 3.1923076923076925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '501297', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 461, 'n_tokens_neox': 449, 'n_words': 90, 'path': 'Feature vectors/feature_vector_calc_final.ipynb', 'repo_name': 'Antimatter98/Sentiment-analysis-project', 'size': '1089'}