I have created a function to handle data processing such as filling null values but the result of the function is returning a series instead of giving me a dataframe. How do I solve this?
def preprocessing(df):
df_columns = ['column1', 'column2','column3','column4', 'column5', 'column6','column7', 'column8']
features= [c for c in df.columns.values if c in df_columns[0:2]]
df = df[features].notna()
features= [c for c in df.columns.values if c in df_columns[2:4]]
max = df[features].max()
df = df[features].fillna(max)
# Fill na with 0
features= [c for c in df.columns.values if c not in df_columns]
df = df[features].fillna(0)
return df
df = preprocessing(df)
df.isnull().sum()