Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

extract first word from string in column into a list in python

# Split a phrase in all rows of a column and make a list of the first word

list_data = [dataset_name.column_name.str.split(' ')[index][0]
             for index in range(0, len(dataset_name))]
print(list_data)
Comment

PREVIOUS NEXT
Code Example
Python :: save python dic 
Python :: ole db 
Python :: use reshape in python with zeros 
Python :: how to sort a list randomly in python 
Python :: getting vocab from a text file python 
Python :: django rest framework encrypt passwors 
Python :: difference between calling a function and referencing a function python 
Python :: come traferire file python 
Python :: two input string sum in django 
Python :: how to write a python script to find the value of x at a given y value 
Python :: how to see a full row in pandas 
Python :: django 2.2 disable cache settings.STATIC_URL 
Python :: cannot import name Glib 
Python :: unittest sleep 
Python :: get a liste from a txt file python 
Python :: how to form a list from a file in python 
Python :: python cows and bulls 
Python :: pyhdb cesu-8 
Python :: Display all resources in table pandas 
Python :: openign in browser python 
Python :: input date args python datetime 
Python :: subprocess ffmpeg x265 codec 
Python :: open anarchy ip 
Python :: float value in regression expression python 
Python :: Insurance= contract.x_studio_social_security_basic salary of ins = 1500 result = contract.x_studio_social_security_basic_salary*100 
Python :: how to insert image in python 
Python :: how to go sown a line in pyton 
Python :: how to get tomorrow date in python 
Python :: ascii value of pi symbol in python 
Python :: how to get coupons from honey in python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =