How can I separate data of one column into multiple column in excel via python or excel formula also?

48 views Asked by At
D:\SVN_EVCU2_Compiler\EVCU_2_0_Project_APP\BUILD/../SSW_TC39X/src/Ifx_Ssw_Tc0.c:121:51: warning: no previous prototype for 'Jump_To_App' [-Wmissing-prototypes]

this is actual data in one column,

I have to separate it like:

(D:\SVN_EVCU2_Compiler\EVCU_2_0_Project_APP\BUILD/.)    (/SSW_TC39X/src/Ifx_Ssw_Tc0.c)       (121:51: warning: no previous prototype for 'Jump_To_App' [-Wmissing-prototypes])

in 3 separate columns.

For this I tried Excel formulas, but it is not working as I want.

Please suggest any solution, python code or excel formula both fine.

3

There are 3 answers

0
Umar Shahid On

You should at least mention the tag (i.e. ',' ':' '.' '' ) where you want to split or separate the string

pathstr = "D:\SVN_EVCU2_Compiler\EVCU_2_0_Project_APP\BUILD/../SSW_TC39X/src/Ifx_Ssw_Tc0.c:121:51: warning: no previous prototype for 'Jump_To_App' [-Wmissing-prototypes]"
pathstr.split(".")
# or
pathstr.split(":")
# or
pathstr.split(" ")
# or 
pathstr.split("\")

This will help separating you string

0
andrewb On

Like this?

A1 contents:

D:\SVN_EVCU2_Compiler\EVCU_2_0_Project_APP\BUILD/../SSW_TC39X/src/Ifx_Ssw_Tc0.c:121:51: warning: no previous prototype for 'Jump_To_App' [-Wmissing-prototypes]

First formula:

=LEFT(A1,FIND("..",A1))

output:

D:\SVN_EVCU2_Compiler\EVCU_2_0_Project_APP\BUILD/.

Second formula:

=MID(A1,FIND("..",A1)+2,FIND(":",A1,3)-FIND("..",A1)-2)

output:

/SSW_TC39X/src/Ifx_Ssw_Tc0.c

Third formula:

=RIGHT(A1,LEN(A1)-FIND(":",A1,3))

output:

121:51: warning: no previous prototype for 'Jump_To_App' [-Wmissing-prototypes]
0
Muhammad Ali On

I hope, this will work for your solution, I use regex to extract and the write then 3 columns into a new excel file,

import pandas as pd
import re
df = pd.read_excel('./one_col_into_multi_cols.xlsx')
df['data_col1'] = df['data'].apply(
    lambda x: '(' + re.findall('(.*)\.\.', x)[0] + ')')
df['data_col2'] = df['data'].apply(
    lambda x: '(' + re.findall('\.\.(.*):', a)[0].split(':')[0] + ')')
df['data_col3'] = df['data'].apply(
    lambda x: '(' + re.findall('\.\w+:(.*)', a)[0] + ')')
df.to_excel("one_col_into_multi_cols_new.xlsx",
            sheet_name='Sheet_name_1',
            index=False)