Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

519
Views
Hacer que varias filas funcionen en pandas dataframe.to_latex()

Tengo el siguiente marco de datos:

 dataset Baseline Version2 F-1 F-2 F-1 F-2 0 G 0.971 0.967 0.971 0.967 1 H 0.780 0.762 0.800 0.777 2 S 0.401 0.320 0.453 0.365 3 T 0.881 0.825 0.989 0.985

Mi objetivo es exportar esto a LaTeX, lo cual hago con pandas.DataFrame.to_latex():

 latex = df.to_latex( index=False, escape=False, sparsify=True, multirow=True, multicolumn=True, multicolumn_format='c', position='H' )

obteniendo el siguiente código en LaTeX:

 \begin{table}[H] \centering \begin{tabular}{lrrrr} \toprule dataset & \multicolumn{2}{c}{Baseline} & \multicolumn{2}{c}{Version2} \\ & F-1 & F-2 & F-1 & F-2 \\ \midrule G & 0.971 & 0.967 & 0.971 & 0.967 \\ H & 0.780 & 0.762 & 0.800 & 0.777 \\ S & 0.401 & 0.320 & 0.453 & 0.365 \\ T & 0.881 & 0.825 & 0.989 & 0.985 \\ \bottomrule \end{tabular} \end{table}

que se representa así: ingrese la descripción de la imagen aquí Mi problema es: esperaría que apareciera una fila múltiple en el "conjunto de datos", cubriendo las 2 líneas con "conjunto de datos" y "", así: ingrese la descripción de la imagen aquí Tengo multirow=True en las opciones, pero no puedo hacer que esto funcione. ¿Alguna idea sobre cómo puedo solucionar esto?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!