How to do this in pandas:
I have a function extract_text_features
on a single text column, returning multiple output columns. Specifically, the function returns 6 values.
The function works, however there doesn't seem to be any proper return type (pandas DataFrame/ numpy array/ Python list) such that the output can get correctly assigned df.ix[: ,10:16] = df.textcol.map(extract_text_features)
So I think I need to drop back to iterating with df.iterrows()
, as per this?
UPDATE:
Iterating with df.iterrows()
is at least 20x slower, so I surrendered and split out the function into six distinct .map(lambda ...)
calls.
UPDATE 2: this question was asked back around v0.11.0. Hence much of the question and answers are not too relevant.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…