Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Get last “column” after .str.split() operation on column in pandas DataFrame

>>> temp = pd.DataFrame({'ticker' : ['spx 5/25/2001 p500', 'spx 5/25/2001 p600', 'spx 5/25/2001 p700']})
>>> temp['ticker'].str.split(' ').str[-1]
0    p500
1    p600
2    p700
Name: ticker, dtype: object
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Get #operation #column #pandas #DataFrame
ADD COMMENT
Topic
Name
3+1 =