0

How can I split this line: Basis of the Consolidated <> Financial Statements by setting <> as a delimiter and create a new row which should not affect other columns?

The data looks like this.

I need to do this in Python code and I tried this but its not working:

for i in range(len(df5)):
    
    df5['text'].iloc[i]=str(df5['text'].iloc[i])
    if((math.isnan(df5['note_number'].iloc[i]==False)):
        a=str(df5['text'].iloc[i])
        a=a.strip()
        u=a.split('<>')
        if j<=(len(df5)):
            j=i+1
            df5['text'].iloc[i]=u[0]
            df5['text'].iloc[i]=u[1]
Koedlt
  • 4,286
  • 8
  • 15
  • 33
Chetna
  • 1
  • 1
  • 1
    Please explain "its not working" with details on errors, output or behavior. Also add more code, so that we can see the definition of `df5` (as example input). We need a [example]. Read [ask] for guidance. – hc_dev Dec 03 '22 at 19:40
  • Can you post the input text where we find `<>` exactly - maybe the output of `print(df5['text'])`. – hc_dev Dec 03 '22 at 19:42
  • sorry, when you mean "not affect other columns" what do you mean - can you please show us an example output table that you're looking for? Thanks! – hlin03 Dec 04 '22 at 11:40

0 Answers0