Colouring column values based on a specific condition. How could I do this?

I struggled to get this to work using \csvautobooklongtable as it is fairly restrictive but I think (?) that using \csvreader[longtable=ll,... creates a long table. Using this setup with csvsimple you can create the table

enter image description here

using the code:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{sample-data.csv}
name, id
Daphne Kub, 1
Karolann Lebsack, 2
Charlotte Parisian, 3
Jairo Mayert, 4
Dr. Adrienne Schulist, 5
Elenora Pacocha, 6
Nikita Mraz, 7
Maya Tremblay, 8
Florine Konopelski, 9
Derrick Volkman, 10
\end{filecontents*}

\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{csvsimple}
\usepackage{caption}
\usepackage{longtable}

\newcommand\ColorID[1]{\ifnum#1>6\color{red}\textbf{#1}\else#1 $<$\fi}

\begin{document}

\csvreader[head to column names,longtable=ll,
           table head={\toprule\bfseries Name &\bfseries ID \\ \midrule},
           table foot={\\\bottomrule}
          ]{sample-data.csv}{}
          {\name &\ColorID\id}

\end{document}

The main point is that I head used head to column names to name the "variables" in each column and the macro \ColorID is used to make the big numbers bold red and to add < to the small numbers.

(I also added the csv file to the MWE using the filecontents package.)

Edit If you wan to keep your data file intact, and not add the name, id header, then you should remove the head to column names and then use, for example, \csvcoli and \csvcolii in the table:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{sample-data.csv}
Daphne Kub, 1
Karolann Lebsack, 2
Charlotte Parisian, 3
Jairo Mayert, 4
Dr. Adrienne Schulist, 5
Elenora Pacocha, 6
Nikita Mraz, 7
Maya Tremblay, 8
Florine Konopelski, 9
Derrick Volkman, 10
\end{filecontents*}

\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{csvsimple}
\usepackage{caption}
\usepackage{longtable}

\newcommand\ColorID[1]{\ifnum#1>6\color{red}\textbf{#1}\else#1 $<$\fi}

\begin{document}

\csvreader[longtable=ll,
           table head={\toprule\bfseries Name &\bfseries ID \\ \midrule},
           table foot={\\\bottomrule}
          ]{sample-data.csv}{}
          {\csvcoli &\ColorID\csvcolii}

\end{document}

An approach with readarray and listofitems.

Here, I simply use the \readdef macro of readarray to input the file contents into a \def\mytabledata, while placing a \\ at the end of each record of input.

Then, I develop the macro \mytable to build the tabular using a token list. I perform a two-tier parsing of \mytabledata first separating rows by way of the inserted \\, and then looking for the comma in each row. After the \readlist*\IDlabel{} invocation, \IDlabel[3,1] for example will contain the name associated with the 3rd file record, whereas \IDlabel[4,2] will contain the id-label associated with the fourth file record. The macro \IDlabel[] is fully expandable, requiring two expansions to get to the tokens that were actually in the file data. Thus, I have provided internal support macros like \xxaddtotabtoks{} to take its argument, expand it twice, and add it to the token list.

I set up a \foreachitem loop to go through each record and add tokens to the token list. I have to create different logic for the first record, since that record is used to make the header. For the other records, I output to the token list the data, while paying attention to the value of the id-label, If it is less than 6, I add a $<$ and if greater than 6, I make it bold red.

Once the loop is done, I merely need to output the token list inside a tabular.

\documentclass{article}
\usepackage{listofitems,xcolor,filecontents,readarray,booktabs}
\begin{filecontents*}{sample-data.csv}
Name, ID
Thing 1, 3
Thing 2, 5
Joe Smith, 6
Jane Doe, 11
\end{filecontents*}
\newtoks\tabtoks
\newcommand\addtotabtoks[1]{\tabtoks\expandafter{\the\tabtoks#1}}
\newcommand\xaddtotabtoks[1]{\expandafter\addtotabtoks\expandafter{#1}}
\newcommand\xxaddtotabtoks[1]{\expandafter\xaddtotabtoks\expandafter{#1}}
\newcommand\mytable[2][0]{%
  \setsepchar{\\/,}%
  \ignoreemptyitems%
  \tabtoks{}%
  \readlist*\IDlabel{#2}%
  \foreachitem\x\in\IDlabel[]{%
   \ifnum\xcnt=1\relax
     \addtotabtoks{\toprule\bfseries}
     \xxaddtotabtoks{\IDlabel[1,1] & \bfseries}
     \xxaddtotabtoks{\IDlabel[1,2] \\\midrule}%
   \else
     \xxaddtotabtoks{\IDlabel[\xcnt,1] & }%
     \ifnum\IDlabel[\xcnt,2]>6\relax\addtotabtoks{\bfseries\color{red}}\fi%
     \xxaddtotabtoks{\IDlabel[\xcnt,2]}%
     \ifnum\IDlabel[\xcnt,2]<6\relax\addtotabtoks{$<$}\fi%
     \addtotabtoks{\\}%
   \fi%
  }%
  \centerline{\begin{tabular}{ll}\the\tabtoks\end{tabular}}%
}
\begin{document}
\readarraysepchar{\\}
\readdef{sample-data.csv}\mytabledata
\mytable{\mytabledata}
\end{document}

enter image description here