stargazer icon indicating copy to clipboard operation
stargazer copied to clipboard

Add multi column

Open mehrdad19 opened this issue 4 years ago • 4 comments

Hello,

My column titles are a bit long and that makes the output table really wide. Is there a way to change the multi column in the header to accept two or more columns?

thanks

mehrdad19 avatar Dec 14 '21 17:12 mehrdad19

Sorry, not sure I understand. Are you asking for two columns (of two different models) to share their title/header?

toobaz avatar Dec 15 '21 09:12 toobaz

I apologize for my mistake. I see the header of the latex output uses "multirow", with one row. Is it possible to change it so it gets two or more rows as input? When the column titles are long, this is usually helpful to keep the width of the table reasonable. I apologize again for my mistake.

mehrdad19 avatar Dec 15 '21 14:12 mehrdad19

I see the header of the latex output uses "multirow"

Do you mean "multicolumn"?

toobaz avatar Jan 30 '22 21:01 toobaz

same question -- how to group multiple columns with one header?

hqs811 avatar Jul 05 '22 10:07 hqs811

@hqs811 can you share your solution? Not being able to do that would really limit the usefulness of the package, at least for my use case.

ozak avatar Oct 22 '22 18:10 ozak

You have to play with Stargazer.custom_column, as follows:

table = Stargazer([mod1, mod1, mod2])
table.custom_columns(['identical', 'different'], [2, 1])

toobaz avatar Oct 22 '22 23:10 toobaz

Perfect! Thanks!

ozak avatar Oct 22 '22 23:10 ozak