0

I am getting an error message that says time data 2017-01-02 13:42:05.378582 does not match format %y-%m-%d %H:%M:%S.%f

start_time = datetime.datetime.strptime(df['timestamp'].min(),'%y-%m-%d %H:%M:%S.%f')
end_time = datetime.datetime.strptime(df['timestamp'].max(),'%y-%m-%d %H:%M:%S.%f')
data_duration = (end_time - start_time).days

print(f"Number of unique users in experiment: {df['user_id'].nunique()}")

1 Answer 1

1

%y is year without century as a zero-padded decimal number (17)

%Y is year with century as a decimal number (2017)

You need: '%Y-%m-%d %H:%M:%S.%f'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.