This commit is contained in:
zhiyang7 2022-02-10 10:33:28 +08:00
parent 921682687c
commit d16ddc872e
2 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,6 @@ 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
@ -224,7 +223,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(json.loads(all_idiom.loc[i].to_json(orient = 'index',force_ascii=False))) result.append(all_idiom.loc[i].to_dict())
return result return result
''' '''

View File

@ -1,2 +1,4 @@
pandas pandas
pypinyin pypinyin
flask==1.1
flask-cors