First, I am fresh new with the PGFPlotTable package! I have the following CSV file that I would like to plot in a LaTeX table:
truncatedtime;meanfinalfloatvalue;floatvaluedifference;datap2count;expecteddatap2count;performance
2015-09-01 00:00:00;0.0375;0.0;48;48;1.0
2015-09-02 00:00:00;-0.247916666666667;0.0;48;48;1.0
2015-09-03 00:00:00;0.364583333333333;0.0;48;48;1.0
2015-09-04 00:00:00;0.397916666666667;0.0;48;48;1.0
2015-09-05 00:00:00;0.310416666666667;0.0;48;48;1.0
[...]
Almost everything works fine with numeric columns, but I cannot compile LaTeX document when I include the first column. I have read the documentation and take a tour of TeX.SO related posts but I could not find any relevant solution.
My include code is the following:
\begin{table}[!ht]
\centering
\pgfplotstabletypeset[
col sep=semicolon,
columns={truncatedtime,meanfinalfloatvalue,floatvaluedifference,datap2count,expecteddatap2count,performance},
columns/truncatedtime/.style={string type},
columns/meanfinalfloatvalue/.style={column name={$\bar{x}$},fixed,zerofill,precision=3},
columns/floatvaluedifference/.style={column name={$\Delta\bar{x}$},fixed,zerofill,precision=3},
columns/datap2count/.style={column name={$n_\mathrm{exp}$}},
columns/expecteddatap2count/.style={column name={$n_\mathrm{th}$}},
columns/performance/.style={column name={$\eta$},fixed,zerofill,precision=3},
header=has colnames,
font=\footnotesize,
dec sep align,
fonts by sign={}{\color{red}},
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule}
]{tables/Aggregate_day_dT_003_T1M003.csv}
\caption{Aggregates (day) for Channel dT:003/T1M003 (MET)\protect\footnotemark}
\label{tab:Aggregates_day_dT:003/T1M003 (MET)}
\end{table}
This code leads to the following error when LaTeX try to parse it:
Package PGF Math Error: Could not parse input '2015-09-25 00:00:00' as a floa
ting point number, sorry. The unreadable part was near '-09-25 00:00:00'..
It looks like PGFPlotsTable
does not notice the string type
style argument and try to cast it into float number which raise a conversion error.
What I have tried so far:
- Enclose timestamp with quotes, does not work;
- Remove the
table
environment that wraps the include and all the features in it, it leads to the same error, it does not seem to have any effect; - Remove the
header=has colnames
argument which I think is not necessary as long as I name my columns, I get the same error
How must I force PGFPlotsTable to consider my column as text? What is going wrong with my code?
Update:
As suggested by fmetz
, I have enclosed my timestamps with curly-braces, now the CSV file has the following form, but it did not solve my problem:
truncatedtime;meanfinalfloatvalue;floatvaluedifference;datap2count;expecteddatap2count;performance
{2015-09-01};0.0375;0.0;48;48;1.0
{2015-09-02};-0.247916666666667;0.0;48;48;1.0
{2015-09-03};0.364583333333333;0.0;48;48;1.0
{2015-09-04};0.397916666666667;0.0;48;48;1.0
{2015-09-05};0.310416666666667;0.0;48;48;1.0
{2015-09-06};0.39375;0.0;48;48;1.0
{2015-09-07};0.414583333333333;0.0;48;48;1.0
{2015-09-08};0.375;0.0;48;48;1.0
[...]
The error remains:
! Package PGF Math Error: Could not parse input '2015-09-06' as a floating poin
t number, sorry. The unreadable part was near '-09-06'..
dec sep align, fonts by sign={}{\color{red}},
columns/meanfinalfloatvalue/.style={column name={$\bar{x}$},fixed,zerofill,precision=3, dec sep align, fonts by sign={}{\color{red}},},