Split first name and last name if there is common matching in another column
Filter your database based on your condition using loops, if condition and group_by method that is available in pandas library this will create you a new object that contains only the filtered values.
From this, you can easily split up the names using regex or using some string functions.
I have a dataset like

+--------------------------------------------------
|    |entity    |individual_name  |investor_name  |
---------------------------------------------------
|  0 |Null      |Null             | Mark Wurtzel  |
|  1 |entity    |Al Ihne          | Ihne LLC      |
|  2 |entity    |Al Ihne          | Ihne LLC      |
|  3 |entity    |Myles Lewis      | JMFM INC      |
|  4 |entity    |Myles Lewis      | JMFM INC      |
|  4 |entity    |Myles Lewis      | JMFM INC      |
+--------------------------------------------------

If my individual_name and investor_name same then first take investor_name and split into first_name and last_name and isSelf is 1 and then take individual_name and split into first_name and last_name and isSelf is would be 0.
and my dataframe look like

+------------------------------------------------------------------------------------------+
|    |entity    |individual_name  |investor_name  | first_name | last_name       | isSelf  |
--------------------------------------------------------------------------------------------
|  0 |Null      |Null             | Mark Wurtzel  |  Mark      | Wurtzel         |     1   |
|  1 |entity    |Al Ihne          | Ihne LLC      |  Ihne      | LLC             |     1   |
|  2 |entity    |Al Ihne          | Ihne LLC      |  AL        | Ihne            |     0   |
|  3 |entity    |Myles Lewis      | JMFM INC      |  JMFM      | INC             |     1   |
|  4 |entity    |Myles Lewis      | JMFM INC      |  Myles     | Lewis           |     0   |
|  5 |entity    |Myles Lewis      | JMFM INC      |  Myles     | Lewis           |     0   |
+------------------------------------------------------------------------------------------+

Thanks in advance