<jupyter_start><jupyter_text>Number of Code Samples<jupyter_code>android["sample"].value_counts()
aws["sample"].value_counts()
azure["sample"].value_counts()
spring["sample"].value_counts()
all["sample"].value_counts()<jupyter_output><empty_output><jupyter_text>Analysis at Pull Request level  Pulls Open X Pulls Closed<jupyter_code>android["state"].value_counts()
aws["state"].value_counts()
azure["state"].value_counts()
spring["state"].value_counts()
all["state"].value_counts()<jupyter_output><empty_output><jupyter_text>Pulls Merged x Not Merged<jupyter_code>android_closed = android[android["state"] == "closed"]
aws_closed = aws[aws["state"] == "closed"]
azure_closed = azure[azure["state"] == "closed"]
spring_closed = spring[spring["state"] == "closed"]
all_closed = all[all["state"] == "closed"]<jupyter_output><empty_output><jupyter_text>Analysis at code sample level<jupyter_code>def set_index(dataframe):
  dataframe.set_index(dataframe["sample"], inplace=True)
  del dataframe["sample"]
set_index(android)
set_index(aws)
set_index(azure)
set_index(spring)
def calculate_stats(dataframe):
  for sample in dataframe.index.unique():
    aux = dataframe.loc[[sample]]
    dataframe.loc[sample, "closed_count"] = aux[aux["state"] == "closed"]["framework"].count()
    dataframe.loc[sample, "open_count"] = aux[aux["state"] == "open"]["framework"].count()
calculate_stats(android)
calculate_stats(aws)
calculate_stats(azure)
calculate_stats(spring)
def aggregate(dataframe, framework):
    dataframe["framework"] = framework
    dataframe = dataframe.groupby(by="sample").mean()
    return dataframe
android = aggregate(android, "Android")
aws = aggregate(aws, "AWS")
azure = aggregate(azure, "Azure")
spring = aggregate(spring, "Spring")
android["framework"] = "Android"
aws["framework"] = "AWS"
azure["framework"] = "Azure"
spring["framework"] = "Spring"
def relative_metrics(dataframe):
    dataframe["relative_open_count"] = (dataframe["open_count"] / (dataframe["open_count"] + dataframe["closed_count"])) * 100
    dataframe["relative_closed_count"] = (dataframe["closed_count"] / (dataframe["open_count"] + dataframe["closed_count"])) * 100
    return dataframe
android = relative_metrics(android)
aws = relative_metrics(aws)
azure = relative_metrics(azure)
spring = relative_metrics(spring)
android.to_csv("2 - Agregar Dados/android.csv")
aws.to_csv("2 - Agregar Dados/aws.csv")
azure.to_csv("2 - Agregar Dados/azure.csv")
spring.to_csv("2 - Agregar Dados/spring.csv")
android.mean()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16686437327006723, 'fraction_numerical': 0.0039541320680110716, 'mean_word_length': 8.768339768339768, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '16100', 'license': 'MIT', 'n_tokens_mistral': 843, 'n_tokens_neox': 841, 'n_words': 136, 'path': '2 - Agregar Dados/AgregarDados.ipynb', 'repo_name': 'researchgroupsoma/VEM2021-Issues', 'size': '2529'}