DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
impute data by using groupby and transform
df['value'] = df.groupby(['category', 'name'])['value'] .transform(lambda x: x.fillna(x.mean()))
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#impute
#data
#groupby
#transform
ADD COMMENT
Topic
COMMENT
Name
8+4 =
Submit