This commit is contained in:
zhiyang7 2022-02-10 10:42:26 +08:00
parent d16ddc872e
commit fa27e4bd51
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import getopt
import pandas as pd import pandas as pd
import re import re
import math import math
import json
from flask import Flask, jsonify, request from flask import Flask, jsonify, request
from flask_cors import CORS from flask_cors import CORS
from pypinyin import pinyin, lazy_pinyin, Style from pypinyin import pinyin, lazy_pinyin, Style
@ -223,7 +224,7 @@ def get_max_group(all_idiom, group, num):
ret_list = group.nlargest(num, ['pinyin_c', 'frequency']).index.tolist() ret_list = group.nlargest(num, ['pinyin_c', 'frequency']).index.tolist()
result = list() result = list()
for i in ret_list: for i in ret_list:
result.append(all_idiom.loc[i].to_dict()) result.append(json.loads(all_idiom.loc[i].to_json(orient = 'index',force_ascii=False)))
return result return result
''' '''