Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: python replace all values in a column 
Python :: find the first occurrence of item in a list in python 
Python :: how to check if email exists in python 
Python :: remove particular row number in pandas 
Python :: lista to txt python 
Python :: python get position of character in string 
Python :: remove rows from pandas dataframe that have text 
Python :: get month name from datetime pandas 
Python :: reset django database 
Python :: datetime to unix timestamp milliseconds python 
Python :: case statement in pandas 
Python :: python put quotes in string 
Python :: string to list separated by space python 
Python :: convert string to utf8 python 
Python :: python append to csv on new line 
Python :: save dataframe to a csv local file pyspark 
Python :: printing float number python 
Python :: python randomly chose user agent 
Python :: how to check python version on terminal 
Python :: python open excel application 
Python :: how to change background of tkinter window 
Python :: jupyter notebook add color text 
Python :: random id python 
Python :: python os open notepad 
Python :: pandas difference between dates 
Python :: addition in python 
Python :: own labels for ticks matplotlib 
Python :: matplotlib secondary y axis 
Python :: geometrical mean python 
Python :: python path from string 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =