0

I have a global sales data for various users. Following is an example:-

        Dates       UserId    SalesQuantity
2020-01-01 01:00:00    101    2000
2020-01-01 02:00:00    101    5000
2020-01-01 01:00:00    102    0
2020-01-01 02:00:00    102     4302
2020-01-01 01:00:00    103    5200
2020-01-01 02:00:00    103    0
2020-01-01 01:00:00    104    2400
2020-01-01 02:00:00    104    234

It is almost 2 years of hourly sales data for each user with no null values. No timestamp is repeated for each user. But there can be 0 sales for a given hour. The dates are in UTC format and I don't know to which country does each user belong. Is there a way to find if a given date for a given user is a weekend or a weekday based on the pattern of the sales data?

Initially I thought of considering Friday to Monday next week as possible weekends for a given user and checked data for that user during these days. But then I realized some countries have weekends on Thursday and Wednesdays too. Please guide what things can I possibly try? I am using R to deal with this data.
  • What do you mean by weekday and weekend? Have a proper definition for that then you could be able to solve the problme – Onyambu Aug 10 '20 at 19:55
  • 1
    What I'm hearing is that you need a statistical method to ***infer*** weekends for various `UserId`s based on frequent absence of data on days of the week. Not knowing context of the data, my first fear is: what if their work schedule changed? Is this job solely fives days per week (whether M-F or based on local weekday convention)? Are you assuming that vacation and sick time will be infrequent enough to be dismissed statistically? – r2evans Aug 10 '20 at 20:28
  • Further, if you don't know the country, how do you know the day of week? The `Dates` timestamps (??) will all be in the same timezone, so `as.Date` may not be correct for any particular user (off by up to 12 hours?). I suggest that to get any strength in your inference, you really need something more in the data. – r2evans Aug 10 '20 at 20:30

0 Answers0