Back to Airflow

Explore Pr Candidates

dev/stats/explore_pr_candidates.ipynb

3.2.11.2 KB
Original Source
python
sys.path.append(".")

import pickle
import pandas as pd
from get_important_pr_candidates import PrStat
python
file = open("prlist", "rb")  # open the pickled file
selected_prs = pickle.load(file)
python
rows = pd.DataFrame()

for pr_stat in selected_prs:
    data = {
        "number": [pr_stat.pull_request.number],
        "url": [pr_stat.pull_request.html_url],
        "title": [pr_stat.pull_request.title],
        "overall_score": [pr_stat.score],
        "label_score": [pr_stat.label_score],
        "length_score": [pr_stat.length_score],
        "body_length": [pr_stat.body_length],
        "comment_length": [pr_stat.comment_length],
        "interaction_score": [pr_stat.interaction_score],
        "comments": [pr_stat.num_comments],
        "reactions": [pr_stat.num_reactions],
        "reviews": [pr_stat.num_reviews],
        "num_interacting_users": [pr_stat.num_interacting_users],
        "change_score": [pr_stat.change_score],
        "additions": [pr_stat.num_additions],
        "deletions": [pr_stat.num_deletions],
        "num_changed_files": [pr_stat.num_changed_files],
    }
    df = pd.DataFrame(data)
    rows = pd.concat([df, rows]).reset_index(drop=True)
python
rows.to_csv("prlist.csv")