DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
add a column while iterating rows pandas
mask = (df['Qty'] == 1) & (df['Price'] == 10) df.loc[mask, 'Buy'] = 1
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#add
#column
#iterating
#rows
#pandas
ADD COMMENT
Topic
COMMENT
Name
4+1 =
Submit