# table transpose

Trying to transpose the table like in my MWE. The result is quit nice, but contains first extra row, I'd like to exclude it. Read pgf manual, used skip rows between index={}{}, but without effect. How to delete this first extra-row (colnames etc...)?

\documentclass{article}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\begin{document}

N    Ans
1   -36
2    33
3   -52
4   -22
5    33
6    38
7    48
8  -100
}\mytable

\pgfplotstabletranspose[string type]\mytablenew{\mytable}

\pgfplotstabletypeset[string type]{\mytablenew}
\end{document}

• Does the solution in Pgfplotstable without headings row help you? Just tested it and it should work. – Alenanno Jan 20 '16 at 13:09
• You could also use \pgfplotstabletranspose[string type, colnames from=N, input colnames to=N]\mytablenew{\mytable} to avoid generating that extra row. colnames from=N tells PGFPlots to use an existing column for the column names, input colnames to=N tells it to use N in the first cell. – Jake Jan 20 '16 at 13:16
• @Alenanno: PGFPlotstable generates column names by default so you have a chance to reference the columns easily after the transposition. Otherwise you might have name clashes in the new column names – Jake Jan 20 '16 at 13:18
• Simply hiding the header row is not an ideal solution, in my opinion, since that stops you from formatting the first row properly. – Jake Jan 20 '16 at 13:19
• @Alenanno: I was trying, but it got closed too quickly. I've voted to reopen. – Jake Jan 20 '16 at 13:25

You can either hide the newly created row when you're printing the transposed table with the approach from Pgfplotstable without headings row (as suggested by Alenanno in the comments).

However, that way you can't use formatting options like every head row, which are especially useful when using booktabs, since you're not printing the head row.

You can stop the new row from being generated by setting

    colnames from=N, input colnames to=N


in the \pgfplotstabletranspose options. The first option tells PGFPlotstable to use an existing column (in this case N) for the column names in the transposed table, the second option tells PGFPlotstable to use N as the header for the original column names.

\documentclass{article}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\begin{document}

N    Ans
1   -36
2    33
3   -52
4   -22
5    33
6    38
7    48
8  -100
}\mytable

\pgfplotstabletranspose[string type,
colnames from=N,
input colnames to=N
]\mytablenew{\mytable}

\pgfplotstabletypeset[