Showing
2 changed files
with
7 additions
and
3 deletions
... | @@ -26,6 +26,10 @@ def save(df,path='problems.csv'): | ... | @@ -26,6 +26,10 @@ def save(df,path='problems.csv'): |
26 | df.to_csv(path) | 26 | df.to_csv(path) |
27 | print('Done.') | 27 | print('Done.') |
28 | 28 | ||
29 | +def load(path='problems.csv'): | ||
30 | + problems=pd.read_csv(path,index_col=0) | ||
31 | + return problems | ||
32 | + | ||
29 | def get_khu_problem_list(): | 33 | def get_khu_problem_list(): |
30 | pageNum=1 | 34 | pageNum=1 |
31 | idx=0 | 35 | idx=0 |
... | @@ -78,7 +82,7 @@ def get_solvedac_level(problems): | ... | @@ -78,7 +82,7 @@ def get_solvedac_level(problems): |
78 | print('Collecting solved.ac level data...:',problemNum) | 82 | print('Collecting solved.ac level data...:',problemNum) |
79 | result=json.loads(res.text) | 83 | result=json.loads(res.text) |
80 | for problem in result['result']['problems']: | 84 | for problem in result['result']['problems']: |
81 | - if problem['id']==problemNum: | 85 | + if int(problem['id'])==int(problemNum): |
82 | problems.loc[problems.problemNum==problemNum,'solvedacLevel']=problem['level'] | 86 | problems.loc[problems.problemNum==problemNum,'solvedacLevel']=problem['level'] |
83 | break | 87 | break |
84 | if idx%SAVE_EVERY==0: | 88 | if idx%SAVE_EVERY==0: |
... | @@ -114,7 +118,7 @@ def get_category(problems): | ... | @@ -114,7 +118,7 @@ def get_category(problems): |
114 | idx=0 | 118 | idx=0 |
115 | problemListLen=len(problemList) | 119 | problemListLen=len(problemList) |
116 | for problemNum in problems['problemNum'].values: | 120 | for problemNum in problems['problemNum'].values: |
117 | - if idx<problemListLen and problemList[idx]['id']==problemNum: | 121 | + if idx<problemListLen and int(problemList[idx]['id'])==int(problemNum): |
118 | category=json.loads(problems.loc[problems.problemNum==problemNum,'category'].values[0]) | 122 | category=json.loads(problems.loc[problems.problemNum==problemNum,'category'].values[0]) |
119 | category.append(tag['full_name_ko']) | 123 | category.append(tag['full_name_ko']) |
120 | problems.loc[problems.problemNum==problemNum,'category']=json.dumps(category,ensure_ascii=False) | 124 | problems.loc[problems.problemNum==problemNum,'category']=json.dumps(category,ensure_ascii=False) | ... | ... |
-
Please register or login to post a comment