My Problem is the following: When creating a dictionary in Jupyter Notebook using Python, the program does not display the full dictionary as per code. Where the dictionary should have len of 1338 (this is the amount of individual lines in my csv doc) it shows me a dictionary with a len of 47. Why is this? I have included my code below.
def create_dict(ages, smoker_statuses, insurance_charges):
smoker_cost = dict()
num_patients = len(ages)
print(num_patients)
for i in range(num_patients):
smoker_cost[ages[i]] = {"Age" : ages[i],
"Smoker" : smoker_statuses[i],
"Charges" : insurance_charges[i]}
return smoker_cost
print(create_dict(ages, smoker_statuses,insurance_charges))
cost_smoker = create_dict(ages, smoker_statuses,insurance_charges)
print(len(cost_smoker))
Thanks to everyone for their help! Dennis