I have a dataframe that looks like this:

```
df = pd.DataFrame([
  {'code': '0101010C0AAAAAA', 'chemical': '0101010C0', 'is_generic': True, 'format': 'AAAA'},
  {'code': '0101010C0BBAAAA', 'chemical': '0101010C0', 'is_generic': False, 'format': 'AAAA'},
  {'code': '0101010F0AAAUAU', 'chemical': '0101010F0', 'is_generic': True, 'format': 'AUAU'},
  {'code': '0101010F0BCAAAU', 'chemical': '0101010F0', 'is_generic': False, 'format': 'AAAU'},
  {'code': '0101010G0AAABAB', 'chemical': '0101010G0', 'is_generic': False, 'format': 'ABAB'}
])
                  code   chemical is_generic format
0      0101010C0AAAAAA  0101010C0       True   AAAA
1      0101010C0BBAAAA  0101010C0      False   AAAA
2      0101010F0AAAUAU  0101010F0       True   AUAU
3      0101010F0BCAAAU  0101010F0      False   AAAU
4      0101010G0AAABAB  0101010G0      False   ABAB

```

I'd like to create a new dataframe with a row for each code where `is_generic` is False. Then I'd like to add a column that for each code, is the code with the same chemical and format, but for which is\_generic is True:

```
           code        generic_equiv
0101010C0BBAAAA      0101010C0AAAAAA
0101010F0BCAAAU      0101010F0AAAUAU
0101010G0AAABAB      None

```

I know how to get the dataframe with a row for each code where `is_generic` is False:

```
df1 = df[df['is_generic'] == True]  

```

I guess I want to do a conditional merge with df, but how to do this?