I want to create a latex table from a pandas DataFrame, but column names are long, and I want to put them vertically, like this:
Currently I am using the to_latex
method, but I do not how to rotate the labels.
This should work by creating a new list based on the column names with the latex command to rotate by 90° and give this list as parameter for the headers:
df.to_latex(escape=False,header=['\\rotatebox{{90}}{{' + c + '}}' for c in df.columns]))