0

I'm trying to replace the '@' of Timestamp with a white space with pandas. Currently my dataframe looks like this:

Timestamp                    name                    sex
2020-03-10@15:45:15           x                      y
2020-03-10@16:00:15           x                      y
2020-03-10@17:15:15           x                      y

What I want as an output:

Timestamp                    name                    sex
2020-03-10 15:45:15           x                      y
2020-03-10 16:00:15           x                      y
2020-03-10 17:15:15           x                      y

The replacement of @ to white space works, but for some reason it only returns the Timestamp column and the others are just gone.

2
  • Is timestamp a datetime column or an object column? Commented Jun 12, 2020 at 16:14
  • So you want to provide a space instead of the character T? Commented Jun 12, 2020 at 16:18

1 Answer 1

1

You can directly replace the string using :

df['TimeStamp'] = df['TimeStamp'].str.replace('T',' ')
Sign up to request clarification or add additional context in comments.

1 Comment

@minpik I thought you have a dataframe that's why I used dataframe. Do you need to perform it on the list? I see that you have changed it to content['Timestamp'] which is not a dataframe but a list

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.