Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python if column is null then

df['real_lastName'] = np.where(df['LastName'].isnull(), df['Middle'], df['LastName'] )

print (df)
  FirstName Middle LastName real_lastName
0       Tom     Ju      NaN            Ju
1      Kity    NaN      Rob           Rob
Comment

PREVIOUS NEXT
Code Example
Python :: remove hh:mm:ss from pandas dataframe column 
Python :: powershell bulk rename and add extra string to filename 
Python :: discord chatterbot python 
Python :: getting-the-last-element-of-a-list 
Python :: pandas split column fixed width 
Python :: how to sort subset of rows in pandas df 
Python :: how to python string up 
Python :: search whole drive for a file in python 
Python :: print 
Python :: includes python 
Python :: streamlit format_func example 
Python :: sum of list of numbers 
Python :: python utf upper() 
Python :: create database tables python 
Python :: calculate the surface area of a cylinder python 
Python :: python serial COM3 
Python :: reverse string in python without using function 
Python :: how can I print all items in a tuple, separated by commas? 
Python :: code pandas from url 
Python :: create instances of a class in a for loop 
Python :: keras sequential layer without input shape 
Python :: python for loop float increment 
Python :: python string to lowercase 
Python :: sqlalchemy one to one foreign key 
Python :: new print on the same line substitution python 3 
Python :: discord embed python 
Python :: pytest for loop 
Python :: python using list as dictionary key 
Python :: get second min no from array in python 
Python :: how to add some thing in python list 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =