Python parse dataframe element
<p>I have a pandas dataframe column (Data Type) which I want to split into three columns</p>

<pre><code>target_table_df = LoadS_A [['Attribute Name',
                              'Data Type',
                              'Primary Key Indicator']]
</code></pre>

<p>Example input (target_table_df)</p>

<pre><code>                 Attribute Name      Data Type Primary Key Indicator
0                       ACC_LIM  DECIMAL(18,4)                 False
1                        ACC_NO   NUMBER(11,0)                 False
2                   ACC_OPEN_DT           DATE                 False
3                          ACCB  DECIMAL(18,4)                 False
4                          ACDB  DECIMAL(18,4)                 False
5                     AGRMNT_ID   NUMBER(11,0)                  True
6                     BRNCH_NUM   NUMBER(11,0)                 False
7                      CLRD_BAL  DECIMAL(18,4)                 False
8              CR_INT_ACRD_GRSS  DECIMAL(18,4)                 False
9               CR_INT_ACRD_NET  DECIMAL(18,4)                 False
</code></pre>

<p>I aim to:</p>

<ul>
<li>Reassign <em>'Data Type'</em> to the text preceding the parenthesis</li>
</ul>

<p><em>[..if parenthesis exists in 'Data Type']:</em></p>

<ul>
<li>Create new column 'Precision' and assign to first comma separated
value</li>
<li>Create new column 'Scale' and assign to second comma separated value</li>
</ul>

<p>Intended output would therefore become:</p>

<pre><code>    Data Type   Precision   Scale
0   decimal 18  4
1   number  11  0
2   date        
3   decimal 18  4
4   decimal 18  4
5   number  4   0
</code></pre>

<p>I have tried in anger to achieve this but i'm new to dataframes....can't work out if I am to iterate over all rows or if there is a way to apply to all values in the dataframe?</p>

<p>Any help much appreciated</p>