import pandas as pd
# Sample DataFrame creation (for illustration)
data = {
'age': [30, 45, 50],
'bp': [120, 130, 140],
'sg': [1.010, 1.015, 1.020],
'al': [0, 1, 2],
'su': [0, 1, 2],
'rbc': ['normal', 'abnormal', 'normal'],
'pc': ['normal', 'abnormal', 'normal'],
'pcc': ['present', 'notpresent', 'present'],
'ba': ['present', 'notpresent', 'present'],
'bgr': [100, 150, 200],
'bu': [20, 30, 15],
'sc': [1.0, 0.8, 1.2],
'sod': [140, 135, 145],
'pot': [4.5, 4.0, 5.0],
'hemo': [14.0, 13.5, 15.0],
'pcv': [42, 45, 48],
'wc': [6000, 7000, 6500],
'rc': [5.0, 4.5, 5.5],
'htn': ['yes', 'no', 'yes'],
'dm': ['no', 'yes', 'no'],
'cad': ['no', 'yes', 'no'],
'appet': ['good', 'poor', 'good'],
'pe': ['no', 'yes', 'no'],
'ane': ['no', 'yes', 'no'],
'class': ['notckd', 'ckd', 'notckd']
}
# Create DataFrame
df = pd.DataFrame(data)
# Define the mapping for renaming
renaming_mapping = {
'age': 'Age in years',
'bp': 'Blood Pressure in mm/Hg',
'sg': 'Specific Gravity (1.005, 1.010, 1.015, 1.020, 1.025)',
'al': 'Albumin (0, 1, 2, 3, 4, 5)',
'su': 'Sugar (0, 1, 2, 3, 4, 5)',
'rbc': 'Red Blood Cells (normal, abnormal)',
'pc': 'Pus Cell (normal, abnormal)',
'pcc': 'Pus Cell clumps (present, not present)',
'ba': 'Bacteria (present, not present)',
'bgr': 'Blood Glucose Random in mgs/dl',
'bu': 'Blood Urea in mgs/dl',
'sc': 'Serum Creatinine in mgs/dl',
'sod': 'Sodium in mEq/L',
'pot': 'Potassium in mEq/L',
'hemo': 'Hemoglobin in gms',
'pcv': 'Packed Cell Volume',
'wc': 'White Blood Cell Count in cells/cumm',
'rc': 'Red Blood Cell Count in millions/cmm',
'htn': 'Hypertension (yes, no)',
'dm': 'Diabetes Mellitus (yes, no)',
'cad': 'Coronary Artery Disease (yes, no)',
'appet': 'Appetite (good, poor)',
'pe': 'Pedal Edema (yes, no)',
'ane': 'Anemia (yes, no)',
'class': 'Class (ckd, notckd)'
}
# Rename the columns in the DataFrame
df.rename(columns=renaming_mapping, inplace=True)
# Display the renamed DataFrame
print(df)