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()}")
CodePudding user response:
%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'