0

Let's say I have this pretty standard CSV file:

id,x0,y,sy,yhat,yerr,yrelerr,ychi2
0,-1,-1.083108355,0.075,-1.013608377,-0.069499978,0.068566894,0.85871057
1,-0.857142857,-0.625857469,0.075,-0.583690434,-0.042167035,0.072242122,0.316099357
2,-0.714285714,-0.103646818,0.075,-0.15377249,0.050125672,-0.32597295,0.446681425
3,-0.571428571,0.378297428,0.075,0.276145454,0.102151974,0.369920899,1.855115709
4,-0.428571429,0.721552903,0.075,0.706063397,0.015489506,0.02193784,0.042653297
5,-0.285714286,1.068762988,0.075,1.135981341,-0.067218353,-0.059172057,0.803254567
6,-0.142857143,1.576471029,0.075,1.565899284,0.010571745,0.006751229,0.019868763
7,0,1.955555616,0.075,1.995817228,-0.040261612,-0.020172995,0.288177313
8,0.142857143,2.358688591,0.075,2.425735171,-0.067046581,-0.027639695,0.799154489
9,0.285714286,2.936295065,0.075,2.855653115,0.08064195,0.028239407,1.15611094
10,0.428571429,3.346102227,0.075,3.285571059,0.060531168,0.018423333,0.651381746
11,0.571428571,3.814462054,0.075,3.715489002,0.098973052,0.026637961,1.741451551
12,0.714285714,4.110972552,0.075,4.145406946,-0.034434394,-0.008306638,0.210795996
13,0.857142857,4.54753839,0.075,4.575324889,-0.027786499,-0.00607312,0.137260362
14,1,4.935172219,0.075,5.005242833,-0.070070614,-0.013999443,0.872869489

And I want to render the table as follow:

\begin{table}[!ht]
\centering
\pgfplotstabletypeset[
debug=true,
col sep={\,},
row sep={\r\n},
header=has colnames,
every head row/.style={before row=\toprule},
every last row/.style={after row=\bottomrule}
]{./media/data.csv}
\end{table}

I am getting this following error:

! Missing \endcsname inserted.
<to be read again> 
                   \protect 
l.11 ]
      {./media/data.csv}

That I don't understand.

I have already tried those posts:

Without success. What is going wrong with this table?

1 Answer 1

2

for your next question could you please provide an example which can be copy-pasted and is compile-ready? This solves a lot of trouble for the people helping you. I managed to compile your table with the following code

\documentclass{article}
\usepackage{csvsimple}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{table}[!ht]
    \centering
    \pgfplotstabletypeset[
        col sep=comma,
        header=has colnames,
        every head row/.style={before row=\toprule},
        every last row/.style={after row=\bottomrule}
    ]{data.csv}
\end{table}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .