so I need to split a data Frame column and get the first item to put in a new column with a lambda fuction. I can't figure out how to do that.
df['Reason'] = df['title'].apply(lambda x: x.split(':'))
I'm getting this for now:
df['Reason'].head()
0 [EMS, BACK PAINS/INJURY]
1 [EMS, DIABETIC EMERGENCY]
2 [Fire, GAS-ODOR/LEAK]
3 [EMS, CARDIAC EMERGENCY]
4 [EMS, DIZZINESS]
and I'd like:
df['Reason'].head()
0 [EMS]
1 [EMS]
2 [Fire]
3 [EMS]
4 [EMS]