"
import pandas as pd
from datetime import datetime
def findfastestlike(log: pd.DataFrame) -> pd.DataFrame:
log=log.sortvalues(['userid','timestamp'])
#get the prev event, time by user
log['prevevent'] = log.groupby('userid')['event'].shift(1)
log['prevtimestamp'] = log.groupby('userid')['timestamp'].shift(1)
True only on rows where the previous event was a login
and the current event is a like
log['loginlike'] = (log['prevevent'] == 'log"
Sean L. - "
import pandas as pd
from datetime import datetime
def findfastestlike(log: pd.DataFrame) -> pd.DataFrame:
log=log.sortvalues(['userid','timestamp'])
#get the prev event, time by user
log['prevevent'] = log.groupby('userid')['event'].shift(1)
log['prevtimestamp'] = log.groupby('userid')['timestamp'].shift(1)
True only on rows where the previous event was a login
and the current event is a like
log['loginlike'] = (log['prevevent'] == 'log"See full answer
"California is a big state and it has roughly 35 million in population, so if we assume there is a gas station for every 500 people so there would be roughly 35,000,000 divided by 500 equal to 70,000 gas station allover the state"
Misho S. - "California is a big state and it has roughly 35 million in population, so if we assume there is a gas station for every 500 people so there would be roughly 35,000,000 divided by 500 equal to 70,000 gas station allover the state"See full answer