next up previous contents
Next: Duplicate keys Up: Importing data into a Previous: Quick instructions   Contents

Temporal data

The Date column is current parsed as strings, which not only will be sorted incorrectly, but even if the data were in a YYYYMMDD format which is sorted correctly, will not have a uniform temporal spacing. It is therefore important to parse the Date column as temporal data, which is achieved by changing the column type to ``time'', and specifying a format string, which follows strftime conventions with the addition of a quarter specifier (%Q).

If your temporal data is in the form Y*M*D*H*M*S, where * signifies any sequence of non-digit characters, and the year, month, day, hour minutes, second fields are regular integers in that order, then you can leave the format string blank . If some of the fields are missing, eg minutes and seconds, then they will be filled in with sensible defaults. \resizebox{\textwidth}{!}{\includegraphics{images/CSVimportDialogTimeFormat}}% WIDTH=555 HEIGHT=291


Table 4.1: Table of strftime codes

\begin{table}\begin{tabular}{\vert c\vert p{.8\textwidth}\vert}
\hline
Code & D...
...ne
\%\% & Literal \% character\tabularnewline
\hline
\end{tabular}\end{table}% WIDTH=555 HEIGHT=384


A Strftime formatted string consists of escape codes (with leading % characters). All other characters are treated as matching literally the characters of the input. So to match a date string of the format YYYY-MM-DD HH:MM:SS+ZZ (ISO format), use a format string ``%Y-%m-%d %H:%M:%S+%Z''. Similarly, for quarterly data expressed like 1972-Q1, use ``%Y-Q%Q''. Note that only %Y and %y can be mixed with %Q (nothing else makes sense anyway).

Note that if your month data uses month names instead of numerical month representation, the it is important you select %d or %e depending on whether your day data has leading zeros or not. This is unfortunately a restriction of the underlying date import routine, which may change in the future.

Even in the current settings, you may still get a message ``exhausted memory -- try reducing the rank'', or a similar message about hitting a 20% of physical memory threshold. In some cases, ``titles'' and ``addresses'' might be pretty much unique for each record, leading to a large, but very sparse hypercube. If you remove those columns, then you may encounter the ``Duplicate key'' message. In this case, you can aggregate over these records--which is desirable anyway to analyse trends in aggregate data. You do this by setting ``Duplicate Key Action'' to sum (or perhaps average for this example). After some additional playing around with dimensions to aggregate over, we can get the data imported. \resizebox{\textwidth}{!}{\includegraphics{images/CSVimportDialogFinal}}% WIDTH=555 HEIGHT=291


next up previous contents
Next: Duplicate keys Up: Importing data into a Previous: Quick instructions   Contents