<jupyter_start><jupyter_text>In theory, for each id (each record), the values in columns late_loans and ontime_loans should add up to the value in the previous_loans_count column<jupyter_code>print(joined.columns)
def validator(row):
    '''validate the assertion'''
    
    late = row['late_loans']
    ontime = row['ontime_loans']
    total = row['previous_loans_count']
    
    assert(late +ontime == total ), 'some id is corrupt'
    
    return Row(SK_ID_CURR=row[id_column],ontime=ontime,late=late,total=total,validated=True)

resulting_df = joined.rdd.map(validator).toDF().
resulting_df.show(1000)

'''Now we could start using this information as a feature to be incorporated during model training'''<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10810810810810811, 'fraction_numerical': 0.005405405405405406, 'mean_word_length': 5.387931034482759, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '580028', 'license': 'MIT', 'n_tokens_mistral': 246, 'n_tokens_neox': 242, 'n_words': 63, 'path': 'notebooks/exploratory_data_analysis.ipynb', 'repo_name': 'ribal-aladeeb/big-data', 'size': '740'}