I have a dataframe named output - 

```
RAW_ENTITY_NAME   ENTITY_TYPE       ENTITY_NAME        IS_MAIN
01-03-2017        TNRMATDT          01 03 2017         1
04-02-2017        TNRSTRTDT         04 02 2017         1
documents         TNRTYPE           SIGHT              1
documents         TNRDOCSBY         NOT FOUND          1
accept            TNRDTL            accept             1 
23                TNRDAYS           23                 1

```

print(df.dtypes()) 

```
RAW_ENTITY_NAME               object
ENTITY_TYPE                   object
ENTITY_NAME                   object
IS_MAIN                       object

```

Note - `ENTITY_TYPE = TNRTYPE`, `ENTITY_NAME = SIGHT` AND `IS_MAIN = 1` will only come once in the dataframe.

I want to update some values if ENTITY\_TYPE is TNRTYPE, ENTITY\_NAME = SIGHT AND IS\_MAIN = 1.

```
temp = output.loc[(output['IS_MAIN'] == 1) & (output['ENTITY_TYPE'] == 'TNRTYPE'), 'ENTITY_NAME']
temp = temp.reset_index(drop=True)
temp = temp[0]
if (temp == 'SIGHT'):
   output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE'] == 'TNRDOCSBY'), 'ENTITY_NAME'] = 'PAYMENT'

   output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE'].isin(['TNRDTL'])),
                                   ['ENTITY_NAME', 'RAW_ENTITY_NAME']] = 'NOT APPLICABLE'

   output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE'].isin(['TNRDAYS'])),
                                   ['ENTITY_NAME']] = '0'

   output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE'].isin(['TNRDAYS'])),
                                   ['RAW_ENTITY_NAME']] = ''

   output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE']=='TNRSTRTDT'),
                                   ['ENTITY_NAME', 'RAW_ENTITY_NAME']] = ''

   output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE']=='TNRMATDT'),
                                   ['ENTITY_NAME', 'RAW_ENTITY_NAME']] = ''

```

The final output is - 

```
RAW_ENTITY_NAME   ENTITY_TYPE       ENTITY_NAME        IS_MAIN
    01-03-2017        TNRMATDT          01 03 2017         1
    04-02-2017        TNRSTRTDT         04 02 2017         1
    documents         TNRTYPE           SIGHT              1
    documents         TNRDOCSBY         PAYMENT            1
    NOT APPLICABLE    TNRDTL            NOT APPLICABLE     1 
                      TNRDAYS           0                  1

```

As you can see everything is getting updated except the first two rows , i.e. ENTITY\_TYPE = TNRMATDT AND TNRSTRTDAT.

I want to know why the below code is not giving the desired results.

```
output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE']=='TNRSTRTDT'),
                                   ['ENTITY_NAME', 'RAW_ENTITY_NAME']] = ''

output.loc[(output['IS_MAIN'] == '1') & (output['ENTITY_TYPE']=='TNRMATDT'),
                                       ['ENTITY_NAME', 'RAW_ENTITY_NAME']] = ''

```

I would be happy if someone could findout the mistake I'm commiting or tell me any work around.

thanks a lot.