<jupyter_start><jupyter_text>Cancer Test Results<jupyter_code># load dataset
import pandas as pd

df= pd.read_csv("cancer_test_data.csv")
print(df.head(15))
# number of patients
numOfPatients= df.shape[0]
print(numOfPatients)
# number of patients with cancer
numOfCancerPatients= df[df["has_cancer"]==True].shape[0]
print(numOfCancerPatients)
# number of patients without cancer
numOfNoCancerPatients= df[df["has_cancer"]==False].shape[0]
print(numOfNoCancerPatients)
# proportion of patients with cancer
cancerPatientProportion= numOfCancerPatients/numOfPatients
print(cancerPatientProportion)
# proportion of patients without cancer
NoCancerPatientProportion= numOfNoCancerPatients/numOfPatients
print(NoCancerPatientProportion)
# proportion of patients with cancer who test positive
cancerPatients= df[df["has_cancer"]==True]
patientWithPositiveCancer= cancerPatients[cancerPatients["test_result"]=="Positive"]
print(patientWithPositiveCancer.shape[0]/numOfCancerPatients)

# proportion of patients with cancer who test negative
cancerPatients= df[df["has_cancer"]==True]
patientWithNegativeCancer= cancerPatients[cancerPatients["test_result"]=="Negative"]
print(patientWithNegativeCancer.shape[0]/numOfCancerPatients)
# proportion of patients without cancer who test positive
cancerPatients= df[df["has_cancer"]==False]
patientWithPositiveNoCancer= cancerPatients[cancerPatients["test_result"]=="Positive"]
print(patientWithPositiveNoCancer.shape[0]/numOfNoCancerPatients)
# proportion of patients without cancer who test negative
cancerPatients= df[df["has_cancer"]==False]
patientWithNegativeNoCancer= cancerPatients[cancerPatients["test_result"]=="Negative"]
print(patientWithNegativeNoCancer.shape[0]/numOfNoCancerPatients)<jupyter_output>0.7963957055214724
{'fraction_non_alphanumeric': 0.10028328611898017, 'fraction_numerical': 0.014730878186968839, 'mean_word_length': 12.584615384615384, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '325898', 'license': 'MIT', 'n_tokens_mistral': 587, 'n_tokens_neox': 511, 'n_words': 102, 'path': 'Probability/Conditional Prob & Bayes Rule/Cancer Diagnosis/Solution (Cancer).ipynb', 'repo_name': 'UmairHabib/AIPND', 'size': '1765'}