0

Essentially, I am parsing through a pandas DF, and am looking to be able to use .loc() to change values if certain conditions are met. Below, is a working example

 Main.loc[Main['Discrepancy Description'].str.contains('test test),'ATA'] = 'Working test'  

This will look through my 'Discrepancy Description' column, and for any cells containing "test test", will replace all ATA values with "working test"

How do I add a second conditional? For example, if the Discrepancy Description equals 'test test' AND ATA=3000, replace all ATA values with 'working test'

Thanks

dom ryan
  • 17
  • 4
  • `numpy.logical_and()` [here](https://numpy.org/doc/stable/reference/generated/numpy.logical_and.html) and its sisters are what you need. – Ahmed Elashry Jan 07 '22 at 23:33
  • `Main.loc[condition1 & condition2, 'ATA'] = "Working test"`? – Barmar Jan 07 '22 at 23:34
  • @Barmar: right. this question gets asked every month for a decade, please see the duplicate. Please help close duplicates as duplicates, fight the tide... – smci Jan 08 '22 at 00:26

0 Answers0