Question: Now write a function called clean _ data which takes a DataFrame as its only argument. This function should satisfy the following specification: It should
Now write a function called cleandata which takes a DataFrame as its only argument. This function should satisfy the following specification:
It should not modify the input DataFrame. Create a copy first, then modify it within the function.
It should remove all rows with missing values. This includes "bad" values that are not of type Missing.
It should remove invalid values in the :price and :area columns.
It should convert the :basicinfo and :extrainfo data into separate columns.
It should convert all columns to appropriate, concrete types. For example, :price should have elements of type Int.
The number of :bedrooms should be between and inclusive.
The number of :bedrooms, :bathrooms, and :stories should all be positive Ints.
The number of :bedrooms, :bathrooms, and :stories should all be reasonable values.
It should drop any redundant columns.
It should return a DataFrame satisfying the above criteria.
Hint: You can check your solution against cleandf by comparing sorted columns; ie sortx sorty where x and y are columns from the two DataFrames being compared. Do this in Julia Version with these packages:
import Pkg
PkgaddCSV
PkgaddPlots
using DataFrames, CSV Plots, StatsPlots, DataFramesMeta
using CategoricalArrays, Statistics, StatsBase
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
