Getting a meaningful metric for variation in this type of cyclical, panel data? WSS won't exactly cut it! This is related to a previous question I have asked, but I am not after visualization but rather a meaningful summary statistic.
Situation: I have many (150k) customers. Each generates his own distribution of shopping times (say, hour of the 24-hour day). Each customer thus has his own empirical distribution of shopping times.
If I want to get a sense of the average within-person variation (distribution, really) in trip times, how might I go about doing this? 
Since time is cyclical, what would a meaningful way to measure within-person variance in trip times? 23 should be closer to 0, rather than 20, for example.  If I could get something here, then I could plot the distribution of those variances, where someone who shops within 1-2 hours always has very low variance, but someone who shops equally likely at any time has the most variation. 
 A: You can calculate the within mean and within standard deviation by hand. Some statistical packages like Stata can provide such summary statistics. For Stata this would be the xtsum command which displays the overall mean as well as the overall, between, and within standard deviations, minimum, and maximum.
If you have Stata you can try
webuse nlswork
xtset idcode year
xtsum ln_wage

which gives the above mentioned panel data statistics for log earnings of each panel (here individuals).
Alternatively, you can calculate all these statistics by hand. The within mean is
$$x_{it} - \overline{x}_i + \overline{\overline{x}}$$
where the overall mean $\overline{\overline{x}}$ is added to make the results comparable across individuals.
If you want the within standard deviation, you need to calculate the within sum of squares as
$$WSS = \sum(x_{it} - \overline{x}_i)^2$$
and divide it by $N\overline{T}-1$ degrees of freedom, where $N$ is the number of panels and $\overline{T}$ is the average length of each panel, and take the square root:
$$\sigma_{within} = \sqrt{\frac{WSS}{N\overline{T}-1}}$$
I'm not quite clear what your time variable is, i.e. whether it is a 24-hour day or is it several days. Either way, you can also calculate the within standard deviation for each person in a given day and treat hours of the day as the time variable. People whose shopping is more dispersed over the day will have larger values than people who shop within a short time-span.
Again, if you have Stata you can cross check the xtsum results by following the above steps:
// generate the within panel mean
egen yi_mean = mean(ln_wage), by(idcode)
// get the within panel deviations from the mean
gen yi_dev = ln_wage - yi_mean
// square those
gen yi_dev_sq = yi_dev^2
// and sum the up to get WSS
egen wss = sum(yi_dev_sq)

// calculate the number of individuals
egen group = group(idcode)
sum group
local n = r(max)

// calculate the average panel length (probably there is a more elegant way than what I am doing but it works)
bysort idcode: gen N = _N
bysort idcode: gen n = _n
replace N = . if N!=n
sum N
local N_bar = r(mean)

// calculate the within standard deviation
di sqrt(wss/(`N_bar'*`n'-1))

