Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

lambda with two columns pandas

tp['col'] = tp.apply(lambda row: row['source'] if row['target'] in ['b', 'n'] else 'x',
                     axis=1)
Comment

apply lambda function to multiple columns pandas

df['new_col'] = df.apply(lambda x: some_func(x['col1'], x['col2'])) 
Comment

PREVIOUS NEXT
Code Example
Python :: add day in date python 
Python :: python get date next week 
Python :: pd.merge left join 
Python :: how to type a dict in python 
Python :: python die 
Python :: torch concat matrix 
Python :: get the center of a blob opencv 
Python :: flatten an irregular list of lists 
Python :: how to import PyMem python 
Python :: pandas select column by index 
Python :: os.remove directory 
Python :: python show png 
Python :: load csv file using pandas 
Python :: time track python 
Python :: print decimal formatting in python 
Python :: plt turn legend off 
Python :: remove too short strings from a list python 
Python :: confusion matrix from two columns pandas dataframe 
Python :: How to convert a string to a dataframe in Python 
Python :: python seconds counter 
Python :: show pythonpath 
Python :: pandas dataframe rename column 
Python :: convert time zone pandas 
Python :: python compare two json objects and get difference 
Python :: web scraping linkedin profiles python jupyter 
Python :: how to install cuda in anaconda 
Python :: pil image from numpy 
Python :: list of files in python 
Python :: python counter to list of tuples 
Python :: python check if all dictionary values are False 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =