> > NB. There are varied amounts of consultants so splitting across columns is 
> > uneven. if it was even melt seems like it would be good 
> > https://dfrieds.com/data-analysis/melt-unpivot-python-pandas
> 
> Keep it simple: https://docs.python.org/3.6/library/string.html
> 
> -- 
> Regards =dn

I have managed to split but not filter the numbers. All other code being the 
same.
...
completed_tasks = df.loc[(df['Completed'] == 'Yes') & (df['Motor/Property'] == 
'Motor') & (df['Delivery Method'] == 'Group Coaching')]
completed_tasks['Consultant'] = completed_tasks['Consultant'].str.split(pat = 
";")
pattern = "\\#d"
completed_tasks['Consultant'] = completed_tasks['Consultant'].str.split(pat = 
";")
completed_tasks['Consultant'] = 
completed_tasks['Consultant'].str.contains(pattern)
...

Works without the regex which causes this error AttributeError: Can only use 
.str accessor with string values, which use np.object_ dtype

pattern = "\\#d"
completed_tasks['Consultant'] = completed_tasks['Consultant'].str.split(pat = 
";")

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to