Day-5 Ai Code
Day-5 Ai Code
ipynb - Colab
format_size format_bold format_italic code link image format_quote format_list_numbered format_list_bulleted horizontal_rule ψ mood
.Write a Python program to clean a dataset by removing duplicate ent .Write a Python program to clean a dataset by removing duplicate
filling missing
entries and filling missing values with the mean of the respective
values with the mean of the respective column.
column.
# Create a DataFrame
df = pd.DataFrame(data)
print("Original Dataset:")
print(df)
print("\nCleaned Dataset:")
print(df)
Original Dataset:
ID Age Salary
0 1 25.0 50000.0
1 2 30.0 60000.0
2 3 35.0 NaN
3 4 NaN 80000.0
4 5 45.0 90000.0
5 2 30.0 60000.0
6 6 NaN 70000.0
Cleaned Dataset:
ID Age Salary
0 1 25.00 50000.0
1 2 30.00 60000.0
2 3 35.00 70000.0
3 4 33.75 80000.0
4 5 45.00 90000.0
6 6 33.75 70000.0
https://colab.research.google.com/drive/1oavejkqUovkIr12hdg44TYQOszJqwIyR#scrollTo=WvmINz-oUrFa&printMode=true 1/1