<jupyter_start><jupyter_text>**REFACTORING_MINER_bug**This notebook the creation of the table `REFACTORING_MINER_bug`, to store if the refactoring produce a bug or not.First, we import the libraries we need and, then, we read the corresponding csv files.<jupyter_code>import pandas as pd
import numpy as np
refactoringMiner = pd.read_csv("../../../data/interim/DataPreparation/CleanData/REFACTORING_MINER_clean.csv")[['projectID', 'commitHash', 'refactoringType']]
print(refactoringMiner.shape)
refactoringMiner.head()
szzFaultInducingCommits = pd.read_csv("../../../data/interim/DataPreparation/CleanData/SZZ_FAULT_INDUCING_COMMITS_clean.csv")[['projectID', 'faultFixingCommitHash', 'faultInducingCommitHash']]
print(szzFaultInducingCommits.shape)
szzFaultInducingCommits.head()<jupyter_output>(27340, 3)<jupyter_text>We merge the tables and, if doing so, there is a NaN, this indicates that it has not induced a bug.<jupyter_code>induced_bug = pd.merge(refactoringMiner, szzFaultInducingCommits, how='left', left_on='commitHash', right_on='faultInducingCommitHash').drop_duplicates().reset_index()
induced_bug
def produce_bug(x):
  if pd.isna(x.faultFixingCommitHash):
    return False
  return True
induced_bug['bug'] = induced_bug.apply(lambda x: produce_bug(x), axis=1)
induced_bug
induced_bug.bug.value_counts()
induced_bug = induced_bug[['projectID_x', 'commitHash', 'refactoringType', 'bug']].rename(columns={'projectID_x': 'projectID'})
induced_bug<jupyter_output><empty_output><jupyter_text>We save this table in a new csv.<jupyter_code>induced_bug.to_csv('../../../data/interim/DataPreparation/ConstructData/REFACTORING_MINER_bug.csv', header=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12788632326820604, 'fraction_numerical': 0.0041444641799881585, 'mean_word_length': 8.234972677595628, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '290480', 'license': 'MIT', 'n_tokens_mistral': 607, 'n_tokens_neox': 587, 'n_words': 108, 'path': 'notebooks/2-DataPreparation/3-ConstructData/5-DB-REFACTORING-MINER-bug.ipynb', 'repo_name': 'chus-chus/softwareDevTypes', 'size': '1689'}