1

I am trying to do multiple operations on an entire column of a dataframe.

Here is a sample data:

df['raw_col'] = '2019/03/20 11:31:51 AM, 2019/03/20 11:19:32 AM'
  1. I want to split this column into a list

df['raw_col'] = ['2019/03/20 11:31:51 AM', '2019/03/20 11:19:32 AM']

  1. I want to access each element of this list and change the string value to DateTime and also add time delta (e.g, change each timestamp to UTC)

  2. Finally, I want to store the result in a new column and as a list.

df['new_col'] = ['2019/03/20 16:31:51 PM', '2019/03/20 16:19:32 PM'] (These time stamps are in UTC)

I figured out the first part

df['raw_col'] = df['raw_col'].str.split(',').tolist()

and I am hoping to get some help on 2nd and 3rd parts

Julia
  • 317
  • 1
  • 12
Prady
  • 1
  • 2

0 Answers0