Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python - concatenate if null

# Option 1
df['concat'] = np.where(df['var_1'] == '', df['var_2'], df['var_1'] + '_u')

# Option 2
def concat_fields(field1, field2):
        if field1.empty:
            return field2
        else:
            return field1 + '_u'  
Comment

PREVIOUS NEXT
Code Example
Python :: python cgi get raw post data 
Python :: how to get current user info in odoo 8 in a controller 
Python :: Print Odd Even Negative Integer Count 
Python :: pandas show head and tail 
Python :: duplicate finder python modules 
Python :: python tags 
Python :: python webscrapping downloading all the videos in a playlist 
Python :: python: dunder init method 
Python :: how to predict the output for new data with the model tested already 
Python :: how to check if a list raises IndexError but wihing a if statement python 
Python :: python difference between multiprocessing pool and threadpool 
Python :: bar chart with x-ticks 
Python :: save file in windows hidden folder python 
Python :: how to copy items in list n times in list python 
Python :: fibonacci sequence script python 
Python :: install matplotlib on nvidia jetson nx 
Python :: Left fill with zeros 
Python :: Python regex emailadres no jpg 
Python :: palindrome without using string function in python 
Python :: python youtube_dl custom path 
Python :: k-means clustering and disabling clusters 
Python :: djago get settings 
Python :: python code syntax checker 
Python :: le %s 
Python :: # check built-in function using dir() 
Python :: Doubleclick .py Prep 
Python :: FizzBuzz in Python Using String Concatenation 
Python :: auto reload exml odoo 13 
Python :: Errors while using os.makedirs() method 
Python :: joining datasets by id python 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =