0

I have to import a csv data with first two string columns and other 5 numeric columns. The numeric columns names are year (ex. 2011 2012 etc.) I want to declare strings columns and numeric column by number of column. In the code I can't use the name of the numeric columns because it change every year. for example I want to say: the first two columns are string columns other columns are numeric columns.

Thank a lot

4
  • 2
    welcome to tex.se! please, be so kind and show us, what you try so far.
    – Zarko
    Nov 3, 2017 at 14:40
  • You can refer to columns via display columns/[index]0/.style=string type
    – percusse
    Nov 3, 2017 at 14:41
  • 2
    @percusse display columns/0/.style={string type}, without the [index]. Nov 3, 2017 at 14:44
  • 1
    @TorbjørnT. OK, coffee time. :)
    – percusse
    Nov 3, 2017 at 14:45

1 Answer 1

1

You can use either display columns/<index>/.style={string type}, or every col no <index>/.style={string type}, where <index> is the column number, with counting starting from zero.

\documentclass[border=5mm]{standalone}
\usepackage{pgfplotstable}
\pgfplotstableread[header=has colnames]{
2011 2012 2013 2014
foo bar 11 2
bar baz 3 43
}\datatable
\begin{document}
\pgfplotstabletypeset[
  display columns/0/.style={string type},
  every col no 1/.style={string type},
]{\datatable}
\end{document}

You must log in to answer this question.

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