Ashar086 commited on
Commit
93fbf36
·
verified ·
1 Parent(s): 47cec27

Create data_processor.py

Browse files
Files changed (1) hide show
  1. data_processor.py +21 -0
data_processor.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+
4
+ class DataProcessor:
5
+ def __init__(self, df):
6
+ self.df = df
7
+
8
+ def get_columns_with_missing_values(self):
9
+ return self.df.columns[self.df.isnull().any()].tolist()
10
+
11
+ def clean_data(self):
12
+ # Remove rows with any missing values
13
+ df_cleaned = self.df.dropna()
14
+
15
+ # Remove duplicate rows
16
+ df_cleaned = df_cleaned.drop_duplicates()
17
+
18
+ # Reset the index
19
+ df_cleaned = df_cleaned.reset_index(drop=True)
20
+
21
+ return df_cleaned