Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Imputation
#1
Hi , I have variables in the data set with missing values . Can anyone please suggest python syntax to :

1 -> Check which of the variables are with missing values in the data frame .
2 -> How to replace the missing values of variables with the mean value .
Reply
#2
OK, it would be rather helpful to know what the 'the' data set format is, and which fields are
part of the mean calculation. Is it the mean value for that specific field over the full range of data,
or the mean of other fields in the same data set?
Reply
#3
Variables are of continuous type and mean calculation is specific to each variable in the data set . For eg : if var 1 had missing values , then would replace it with average of var1 calculated .
Reply
#4
Ok, so you need:
  • pass through the data set summing all fields that require imputation
  • If a field is empty, add zero to sum, but do add 1 to divisor.
  • next calculate the mean for fields which require imputation
  • pass again through data set, replacing empty fields with mean value calculated above.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020