数据工具错误!缺少数字,视为零。

数据工具错误!缺少数字,视为零。

sample.tex的是 -

\documentclass{article}
\usepackage{datatool}
\DTLloaddb{coefficient}{coefficient.csv}
\begin{document}
\DTLfetch{coefficient}{academicYear}{Estimate}
\end{document}

并且coefficient.csv是 -

"","Estimate","Pr(>|t|)"
"(Intercept)",3083.10823266321,0.410258948870845
"academicYear",-154.682625625893,0.586945960271761
"tuitionOfferPerMonth",166.418331237849,0.626598991149528
"tutionsYouHaveDone",88.1170833442809,0.687790764988264
"result",2174.73550930876,0.0319792901914711
"teachingHour",762.859932701096,0.421832171976142
"subjectsYouTaught",-99.4216388435531,0.831181012593366
"daysInWeek",-471.260444393369,0.409951748818405
"tuitionType",469.36175552496,0.446727615621479
"studentClass",159.808778458308,0.249053825131443
"Dept.science",1902.80982919603,0.105027526587972
"Hall",-1057.61231171402,0.196789600388924

结果sample.tex-

(/usr/local/texlive/2017/texmf-dist/tex/latex/fp/fp-upn.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/fp/fp-eval.sty))))) (./delete.aux
)
! Missing number, treated as zero.
<to be read again> 
                   \dtl@ci@coefficient@academicYear 
l.6 \end
        {document}
?

答案1

\DTLfetch需要四个参数:数据库标签列1键价值column2 键。它旨在找到第一行,其中给出的列由列1键火柴价值并返回由以下标识的列的值column2 键同一行。

您的数据没有第一列的标签,因此我建议您使用keys分配列标签的选项:

\documentclass{article}
\usepackage{datatool}
\DTLloaddb[keys={description,Estimate,Pr}]{coefficient}{coefficient.csv}
\begin{document}
\DTLfetch{coefficient}{description}{academicYear}{Estimate}
\end{document}

相关内容