diff --git a/solution/2800-2899/2877.Create a DataFrame from List/README.md b/solution/2800-2899/2877.Create a DataFrame from List/README.md index af17c4c551f1a..e64080d83274b 100644 --- a/solution/2800-2899/2877.Create a DataFrame from List/README.md +++ b/solution/2800-2899/2877.Create a DataFrame from List/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2877.Create%20a%20DataFrame%20from%20List/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2877.Create a DataFrame from List/README_EN.md b/solution/2800-2899/2877.Create a DataFrame from List/README_EN.md index ec79e540aba24..edf701da08593 100644 --- a/solution/2800-2899/2877.Create a DataFrame from List/README_EN.md +++ b/solution/2800-2899/2877.Create a DataFrame from List/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2877.Create%20a%20DataFrame%20from%20List/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2878.Get the Size of a DataFrame/README.md b/solution/2800-2899/2878.Get the Size of a DataFrame/README.md index 03b4e385d592d..f8ac06b407d77 100644 --- a/solution/2800-2899/2878.Get the Size of a DataFrame/README.md +++ b/solution/2800-2899/2878.Get the Size of a DataFrame/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2878.Get%20the%20Size%20of%20a%20DataFrame/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2878.Get the Size of a DataFrame/README_EN.md b/solution/2800-2899/2878.Get the Size of a DataFrame/README_EN.md index 7435e6575aeba..44aafb3521ad1 100644 --- a/solution/2800-2899/2878.Get the Size of a DataFrame/README_EN.md +++ b/solution/2800-2899/2878.Get the Size of a DataFrame/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2878.Get%20the%20Size%20of%20a%20DataFrame/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2879.Display the First Three Rows/README.md b/solution/2800-2899/2879.Display the First Three Rows/README.md index 7add9ef1015db..f92ecef09dc71 100644 --- a/solution/2800-2899/2879.Display the First Three Rows/README.md +++ b/solution/2800-2899/2879.Display the First Three Rows/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2879.Display%20the%20First%20Three%20Rows/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2879.Display the First Three Rows/README_EN.md b/solution/2800-2899/2879.Display the First Three Rows/README_EN.md index 17cf6c32e37f2..9725066b10ca2 100644 --- a/solution/2800-2899/2879.Display the First Three Rows/README_EN.md +++ b/solution/2800-2899/2879.Display the First Three Rows/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2879.Display%20the%20First%20Three%20Rows/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2880.Select Data/README.md b/solution/2800-2899/2880.Select Data/README.md index 01e71a9a4e30d..499237bb2f326 100644 --- a/solution/2800-2899/2880.Select Data/README.md +++ b/solution/2800-2899/2880.Select Data/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2880.Select%20Data/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2880.Select Data/README_EN.md b/solution/2800-2899/2880.Select Data/README_EN.md index 3ef7e1fc6abc6..12b4604020741 100644 --- a/solution/2800-2899/2880.Select Data/README_EN.md +++ b/solution/2800-2899/2880.Select Data/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2880.Select%20Data/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2881.Create a New Column/README.md b/solution/2800-2899/2881.Create a New Column/README.md index 5936ae2836884..08a5525b47098 100644 --- a/solution/2800-2899/2881.Create a New Column/README.md +++ b/solution/2800-2899/2881.Create a New Column/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2881.Create%20a%20New%20Column/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2881.Create a New Column/README_EN.md b/solution/2800-2899/2881.Create a New Column/README_EN.md index 95e49f2f7505b..ecd3c86203abd 100644 --- a/solution/2800-2899/2881.Create a New Column/README_EN.md +++ b/solution/2800-2899/2881.Create a New Column/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2881.Create%20a%20New%20Column/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2882.Drop Duplicate Rows/README.md b/solution/2800-2899/2882.Drop Duplicate Rows/README.md index 31336eb2f7c77..95ae1ad2542b4 100644 --- a/solution/2800-2899/2882.Drop Duplicate Rows/README.md +++ b/solution/2800-2899/2882.Drop Duplicate Rows/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2882.Drop%20Duplicate%20Rows/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2882.Drop Duplicate Rows/README_EN.md b/solution/2800-2899/2882.Drop Duplicate Rows/README_EN.md index 98a4575fae33b..8d5c27c61209a 100644 --- a/solution/2800-2899/2882.Drop Duplicate Rows/README_EN.md +++ b/solution/2800-2899/2882.Drop Duplicate Rows/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2882.Drop%20Duplicate%20Rows/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2883.Drop Missing Data/README.md b/solution/2800-2899/2883.Drop Missing Data/README.md index 91d0adb9511ec..99fe13d357460 100644 --- a/solution/2800-2899/2883.Drop Missing Data/README.md +++ b/solution/2800-2899/2883.Drop Missing Data/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2883.Drop%20Missing%20Data/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2883.Drop Missing Data/README_EN.md b/solution/2800-2899/2883.Drop Missing Data/README_EN.md index 56f4882b0bff2..abc89e35ef8e1 100644 --- a/solution/2800-2899/2883.Drop Missing Data/README_EN.md +++ b/solution/2800-2899/2883.Drop Missing Data/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2883.Drop%20Missing%20Data/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2884.Modify Columns/README.md b/solution/2800-2899/2884.Modify Columns/README.md index 2abc8f39b2efd..fa9f451c1ab7b 100644 --- a/solution/2800-2899/2884.Modify Columns/README.md +++ b/solution/2800-2899/2884.Modify Columns/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2884.Modify%20Columns/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2884.Modify Columns/README_EN.md b/solution/2800-2899/2884.Modify Columns/README_EN.md index 40bc13c3e448e..01542f5b86115 100644 --- a/solution/2800-2899/2884.Modify Columns/README_EN.md +++ b/solution/2800-2899/2884.Modify Columns/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2884.Modify%20Columns/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2885.Rename Columns/README.md b/solution/2800-2899/2885.Rename Columns/README.md index f5c78626c41d4..e0cd4a02ee73c 100644 --- a/solution/2800-2899/2885.Rename Columns/README.md +++ b/solution/2800-2899/2885.Rename Columns/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2885.Rename%20Columns/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2885.Rename Columns/README_EN.md b/solution/2800-2899/2885.Rename Columns/README_EN.md index 56109b807d7d6..f57d8137e20c3 100644 --- a/solution/2800-2899/2885.Rename Columns/README_EN.md +++ b/solution/2800-2899/2885.Rename Columns/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2885.Rename%20Columns/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2886.Change Data Type/README.md b/solution/2800-2899/2886.Change Data Type/README.md index 118dd87612f31..cfc18d75f36ca 100644 --- a/solution/2800-2899/2886.Change Data Type/README.md +++ b/solution/2800-2899/2886.Change Data Type/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2886.Change%20Data%20Type/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2886.Change Data Type/README_EN.md b/solution/2800-2899/2886.Change Data Type/README_EN.md index 6abceaf8ab540..f4ab807504444 100644 --- a/solution/2800-2899/2886.Change Data Type/README_EN.md +++ b/solution/2800-2899/2886.Change Data Type/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2886.Change%20Data%20Type/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2887.Fill Missing Data/README.md b/solution/2800-2899/2887.Fill Missing Data/README.md index b1ba92f07ec57..3776c79465fb3 100644 --- a/solution/2800-2899/2887.Fill Missing Data/README.md +++ b/solution/2800-2899/2887.Fill Missing Data/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2887.Fill%20Missing%20Data/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2887.Fill Missing Data/README_EN.md b/solution/2800-2899/2887.Fill Missing Data/README_EN.md index 4d99aba7a40d0..7233e0fa47d09 100644 --- a/solution/2800-2899/2887.Fill Missing Data/README_EN.md +++ b/solution/2800-2899/2887.Fill Missing Data/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2887.Fill%20Missing%20Data/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2888.Reshape Data Concatenate/README.md b/solution/2800-2899/2888.Reshape Data Concatenate/README.md index 860c3b5bf3248..2563dbf6407c3 100644 --- a/solution/2800-2899/2888.Reshape Data Concatenate/README.md +++ b/solution/2800-2899/2888.Reshape Data Concatenate/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2888.Reshape%20Data%20Concatenate/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2888.Reshape Data Concatenate/README_EN.md b/solution/2800-2899/2888.Reshape Data Concatenate/README_EN.md index 5c242024d21c3..3b42ddab775c5 100644 --- a/solution/2800-2899/2888.Reshape Data Concatenate/README_EN.md +++ b/solution/2800-2899/2888.Reshape Data Concatenate/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2888.Reshape%20Data%20Concatenate/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2889.Reshape Data Pivot/README.md b/solution/2800-2899/2889.Reshape Data Pivot/README.md index 6200b305ec24d..bd8120bc5778b 100644 --- a/solution/2800-2899/2889.Reshape Data Pivot/README.md +++ b/solution/2800-2899/2889.Reshape Data Pivot/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2889.Reshape%20Data%20Pivot/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2889.Reshape Data Pivot/README_EN.md b/solution/2800-2899/2889.Reshape Data Pivot/README_EN.md index b19307c79ec01..28249d6629209 100644 --- a/solution/2800-2899/2889.Reshape Data Pivot/README_EN.md +++ b/solution/2800-2899/2889.Reshape Data Pivot/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2889.Reshape%20Data%20Pivot/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2890.Reshape Data Melt/README.md b/solution/2800-2899/2890.Reshape Data Melt/README.md index 72af9666a4773..b4acedbc6077b 100644 --- a/solution/2800-2899/2890.Reshape Data Melt/README.md +++ b/solution/2800-2899/2890.Reshape Data Melt/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2890.Reshape%20Data%20Melt/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2890.Reshape Data Melt/README_EN.md b/solution/2800-2899/2890.Reshape Data Melt/README_EN.md index 2a801e66032f6..46f20e1fe8942 100644 --- a/solution/2800-2899/2890.Reshape Data Melt/README_EN.md +++ b/solution/2800-2899/2890.Reshape Data Melt/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2890.Reshape%20Data%20Melt/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2891.Method Chaining/README.md b/solution/2800-2899/2891.Method Chaining/README.md index be595f3dffbf8..7475f5d65277d 100644 --- a/solution/2800-2899/2891.Method Chaining/README.md +++ b/solution/2800-2899/2891.Method Chaining/README.md @@ -3,7 +3,7 @@ comments: true difficulty: 简单 edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2891.Method%20Chaining/README.md tags: - - pandas + - Pandas --- diff --git a/solution/2800-2899/2891.Method Chaining/README_EN.md b/solution/2800-2899/2891.Method Chaining/README_EN.md index 70914a64242dd..946ce123a15d8 100644 --- a/solution/2800-2899/2891.Method Chaining/README_EN.md +++ b/solution/2800-2899/2891.Method Chaining/README_EN.md @@ -3,7 +3,7 @@ comments: true difficulty: Easy edit_url: https://github.com/doocs/leetcode/edit/main/solution/2800-2899/2891.Method%20Chaining/README_EN.md tags: - - pandas + - Pandas --- diff --git a/solution/util.py b/solution/util.py index 7d0a40829c454..ad124cb1069d5 100644 --- a/solution/util.py +++ b/solution/util.py @@ -54,9 +54,7 @@ def load_ratings(): category_readme_cn = load_template("category_readme_template") category_readme_en = load_template("category_readme_template_en") -category_dict = { - "Database": "数据库", -} +category_dict = {"Database": "数据库"} def load_cookies() -> Tuple[str, str]: @@ -177,11 +175,11 @@ def generate_question_readme(result): readme_template_cn, readme_template_en = select_templates(category) paid_only = " 🔒" if item["paid_only"] else "" rating_item = rating_dict.get(str(item["frontend_question_id"])) - rating = rating_item.get('Rating', 0) if rating_item else '' + rating = rating_item.get("Rating", 0) if rating_item else "" source = ( - rating_item.get('ContestID_zh') + " " + rating_item.get('ProblemIndex') + rating_item.get("ContestID_zh") + " " + rating_item.get("ProblemIndex") if rating_item - else '' + else "" ) # 生成 metadata """ @@ -195,20 +193,22 @@ def generate_question_readme(result): edit_url: https://github.com/doocs/leetcode/edit/main/solution/0000-0099/0001.Two%20Sum/README.md --- """ + cat = category_dict.get(category, category) + cat = cat.title() if cat and cat[0].islower() else cat metadata = { - "tags": item["tags_cn"] or [category_dict.get(category, category)], + "tags": item["tags_cn"] or [cat], "difficulty": item["difficulty_cn"], "rating": rating, "comments": True, "edit_url": f'https://github.com/doocs/leetcode/edit/main{item["relative_path_cn"]}', "source": source, } - if not item['tags_cn']: - metadata.pop('tags') + if not item["tags_cn"]: + metadata.pop("tags") if not rating: - metadata.pop('rating') + metadata.pop("rating") if not source: - metadata.pop('source') + metadata.pop("source") yaml_metadata = yaml.dump( metadata, default_flow_style=False, allow_unicode=True ) @@ -228,24 +228,26 @@ def generate_question_readme(result): ) source = ( - rating_item.get('ContestID_en') + " " + rating_item.get('ProblemIndex') + rating_item.get("ContestID_en") + " " + rating_item.get("ProblemIndex") if rating_item - else '' + else "" ) + + cat = category.title() if category and category[0].islower() else category metadata = { - "tags": item["tags_en"] or [category], + "tags": item["tags_en"] or [cat], "difficulty": item["difficulty_en"], "rating": rating, "comments": True, "edit_url": f'https://github.com/doocs/leetcode/edit/main{item["relative_path_en"]}', "source": source, } - if not item['tags_cn']: - metadata.pop('tags') + if not item["tags_cn"]: + metadata.pop("tags") if not rating: - metadata.pop('rating') + metadata.pop("rating") if not source: - metadata.pop('source') + metadata.pop("source") yaml_metadata = yaml.dump( metadata, default_flow_style=False, allow_unicode=True ) @@ -363,27 +365,29 @@ def refresh(result): readme_template_cn, readme_template_en = select_templates(category) rating_item = rating_dict.get(str(front_question_id)) - rating = int(rating_item.get('Rating', 0)) if rating_item else '' + rating = int(rating_item.get("Rating", 0)) if rating_item else "" source = ( - rating_item.get('ContestID_zh') + " " + rating_item.get('ProblemIndex') + rating_item.get("ContestID_zh") + " " + rating_item.get("ProblemIndex") if rating_item - else '' + else "" ) - + cat = category_dict.get(category, category) + cat = cat.title() if cat and cat[0].islower() else cat metadata = { - "tags": question["tags_cn"] or [category_dict.get(category, category)], + "tags": question["tags_cn"] or [cat], "difficulty": question["difficulty_cn"], "rating": rating, "comments": True, "edit_url": f'https://github.com/doocs/leetcode/edit/main{question["relative_path_cn"]}', "source": source, } - if not question['tags_cn'] and not [category_dict.get(category, category)]: - metadata.pop('tags') + + if not question["tags_cn"] and not cat: + metadata.pop("tags") if not rating: - metadata.pop('rating') + metadata.pop("rating") if not source: - metadata.pop('source') + metadata.pop("source") yaml_metadata = yaml.dump( metadata, default_flow_style=False, allow_unicode=True ) @@ -402,25 +406,26 @@ def refresh(result): ) source = ( - rating_item.get('ContestID_en') + " " + rating_item.get('ProblemIndex') + rating_item.get("ContestID_en") + " " + rating_item.get("ProblemIndex") if rating_item - else '' + else "" ) + cat = category.title() if category and category[0].islower() else category metadata = { - "tags": question["tags_en"] or [category], + "tags": question["tags_en"] or [cat], "difficulty": question["difficulty_en"], "rating": rating, "comments": True, "edit_url": f'https://github.com/doocs/leetcode/edit/main{question["relative_path_en"]}', "source": source, } - if not question['tags_en'] and not [category]: - metadata.pop('tags') + if not question["tags_en"] and not [category]: + metadata.pop("tags") if not rating: - metadata.pop('rating') + metadata.pop("rating") if not source: - metadata.pop('source') + metadata.pop("source") yaml_metadata = yaml.dump( metadata, default_flow_style=False, allow_unicode=True )