0

I have obtained the following code for table in latex format from python. But it shows me error when I run it on latex. How can I solve this problem?

\begin{table}[!htbp] \centering
\begin{tabular}{@{\extracolsep{5pt}}lcccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{4}{c}{\textit{Dependent variable:}} \
\cr \cline{4-5}
\\[-1.8ex] & (1) & (2) & (3) & (4) \\
\hline \\[-1.8ex]
 age & 0.003$^{***}$ & 0.002$^{***}$ & 0.002$^{***}$ & 0.001$^{***}$ \\
  & (0.000) & (0.000) & (0.000) & (0.000) \\
 baths & 0.073$^{***}$ & 0.070$^{***}$ & 0.072$^{***}$ & 0.070$^{***}$ \\
  & (0.002) & (0.002) & (0.002) & (0.002) \\
 condA & 0.546$^{***}$ & 0.541$^{***}$ & 0.546$^{***}$ & 0.493$^{***}$ \\
  & (0.017) & (0.017) & (0.017) & (0.017) \\
 condB & 0.266$^{***}$ & 0.259$^{***}$ & 0.265$^{***}$ & 0.240$^{***}$ \\
  & (0.017) & (0.017) & (0.017) & (0.017) \\
 condC & 0.116$^{***}$ & 0.116$^{***}$ & 0.115$^{***}$ & 0.111$^{***}$ \\
  & (0.018) & (0.018) & (0.018) & (0.018) \\
 const & 10.651$^{***}$ & 10.701$^{***}$ & 10.654$^{***}$ & 10.612$^{***}$ \\
  & (0.018) & (0.018) & (0.018) & (0.018) \\
 fireplace & 0.096$^{***}$ & 0.095$^{***}$ & 0.096$^{***}$ & 0.096$^{***}$ \\
  & (0.003) & (0.003) & (0.003) & (0.003) \\
 garage_area & 0.000$^{***}$ & 0.000$^{***}$ & 0.000$^{***}$ & 0.000$^{***}$ \\
  & (0.000) & (0.000) & (0.000) & (0.000) \\
 lakedist & & -0.002$^{***}$ & & -0.001$^{***}$ \\
  & & (0.000) & & (0.000) \\
 living_area & 0.000$^{***}$ & 0.000$^{***}$ & 0.000$^{***}$ & 0.000$^{***}$ \\
  & (0.000) & (0.000) & (0.000) & (0.000) \\
 lkdist & & & 0.063$^{***}$ & \\
  & & & (0.006) & \\
 median_commute & & & & 0.004$^{***}$ \\
  & & & & (0.000) \\
\hline \\[-1.8ex]
 Observations & 38,817 & 38,817 & 38,817 & 38,817 \\
 $R^2$ & 0.809 & 0.811 & 0.809 & 0.815 \\
 Adjusted $R^2$ & 0.809 & 0.811 & 0.809 & 0.815 \\
 Residual Std. Error & 0.169(df = 38808) & 0.168(df = 38807) & 0.169(df = 38807) & 0.166(df = 38806)  \\
 F Statistic & 20501.924$^{***}$ (df = 8.0; 38808.0) & 18497.923$^{***}$ (df = 9.0; 38807.0) & 18282.218$^{***}$ (df = 9.0; 38807.0) & 17115.588$^{***}$ (df = 10.0; 38806.0) \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{4}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
David Carlisle
  • 757,742
Jui Sen
  • 101
  • Welcome to TeX.SE. Please edit your posting to replace all instances of \\\\ with \\ and all instances of \n with an invisible end-of-line character. – Mico Feb 20 '21 at 10:31
  • Please also add the documentclass you use, as well as the relevant packages. It would also be helpful if you quoted the error message you get. – leandriis Feb 20 '21 at 10:33
  • 1
    I guess, the error message you get is caused by the use of _ , e. g. in garage_area. To get rid of the error messages, replace _ with \_ See also: https://tex.stackexchange.com/a/554241/134144 – leandriis Feb 20 '21 at 10:43

0 Answers0