Hey guys I was wondering what exactly this code does, how does it iterate through the dataframe
and what exactly does the lambda function do?
df.apply(lambda x: pd.Series(x.dropna().values))
Hey guys I was wondering what exactly this code does, how does it iterate through the dataframe
and what exactly does the lambda function do?
df.apply(lambda x: pd.Series(x.dropna().values))
The above block of code traverses the data frame column-wise and drops NA values. Lambda functions are the anonymous functions that are well explained in this text.