I have a big pandas.DataFrame
(~2.5 million rows) with 10 columns. I need to fill column noshow_label
, i group data by column event_label
and if in column event_action
there is a value no_show
then i need to paste True
else i need paste False
.
To do that i use this construction:
data['noshow_label'] = data.groupby('event_label')['event_action'].transform(lambda x: 'no_show' in x.values)
When i tried to start this code, it raised an error:
ValueError: Length mismatch: Expected axis has 2328271 elements, new values have 2328273 elements
For note: Column
event_action
contains values likeno_show
,show_widget
,test_passed
. Column 'event_labelcontains labels names like
123123-A`, '123123-B' ...
Do you have any ideas to fix it?