text to columns with comma delimiter using python
<p>how to divide a column in to two columns in an excel using a delimiter ', 'and name the header's  using python</p>

<p>here is my code</p>

<pre><code>import openpyxl


w=openpyxl.load_workbook('DDdata.xlsx')
active=w.active


a=active.columns[1]
for cellobj in a:
    s=cellobj.value
    fila=s.split(',')

    print(fila)
</code></pre>

<p><a href="https://drive.google.com/file/d/0Bw8qvPLsyp8dWG5Lc0dBbHpwMEU/view?usp=sharing" rel="nofollow">Input file link</a></p>

<p><a href="http://i.stack.imgur.com/VueSu.jpg" rel="nofollow">outputfile</a></p>

<p>This looks to be a duplicate of <a href="http://stackoverflow.com/questions/14745022/pandas-dataframe-how-do-i-split-a-column-into-two">this post</a>, but here's a solution for you to consider:</p>

<pre><code>import pandas as pd

df = pd.read_excel('input.xlsx')

df['First Name'], df['Last Name'] = df['Applicant Name'].str.split(',', 1).str
del df['Applicant Name']

df.to_excel('output.xlsx')
</code></pre>

<p>Output (in python):</p>

<pre><code>First Name  Last Name
0   -   Mohammed Abdul Naser Aziz
1   -   Gottipati Harshavardhan
2   -   Sandeep Kaur
3   .   Rounak
4   abbas   Syed
5   Abbas   Mohd Manzar
6   Abbasi  Fatema
7   Abdelkader  BEKHTIE
8   abdollahzadehkan    mina
</code></pre>

python python-3.x pandas openpyxl