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 :: how to convert into grayscale opencv 
Python :: only keep rows of a dataframe based on a column value 
Python :: program to print duplicates from a list of integers in python 
Python :: pandas read_csv dtype datetime 
Python :: pandas dataframe get number of occurrence in column 
Python :: selenium open inspect 
Python :: python copy 
Python :: file.open("file.txt); 
Python :: pygame tick time 
Python :: pd df append 
Python :: how to split text into list python by characters 
Python :: count unique elements in list python 
Python :: SystemError: tile cannot extend outside image 
Python :: print( n ) in python 
Python :: 3d array numpy 
Python :: replace key of dictionary python 
Python :: flask remove file after send_file 
Python :: random search cv 
Python :: pd.dataframe initial columns 
Python :: split a string with 2 char each in python 
Python :: moving averages python 
Python :: python remove all elemnts in list containing string 
Python :: spam python 
Python :: django set session variable 
Python :: access row of dataframe 
Python :: ignore pytest errors or warnings 
Python :: python create directory if non existent 
Python :: python array extend 
Python :: pyspark print a column 
Python :: add place in certain index python string 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =