0

During a pandas DF loop, i'm trying to split the result of variable in two, but i got an error:

My code:

 ...  
 for e in zip(list(df[each_column]), list(df['epoch'])):
      print(metric,'=',e)
      epoch_time = e.split(',')[1]
      value = e.split(',')[0]
 ...

The print of variable e:

on 0: metric = ('1121', 1656428160)
on 0: metric = ('1101', 1656428220)
on 0: metric = ('1015', 1656428280)

I would like to get

on 0: metric = 1121 1656428160
on 0: metric = 1101 1656428220
on 0: metric = 1015 1656428280

--> error when i tried to split e:

AttributeError: 'tuple' object has no attribute 'split'

How can i get each value separately?

Many thanks for help

Indi59
  • 171
  • 2
  • 10

1 Answers1

0

Your variable e is in tuple which can't be split. However you can convert it to a list and then print it like this:

print(*list(e))
SIAJSAJ IJSAIJSAJA
  • 329
  • 1
  • 3
  • 14