I have a DataFrame, and I want to paste it as PNG/JPEG in a Powerpoint.
I want the table to have some formatting. I have been trying with Matplotlib, and plotly, but I am not getting closer to the end result.
import matplotlib.pyplot as plt
# Prepare table
df = full_table
hc = '#1D97FF'
columns=full_table.columns.to_list()
index=full_table.index.to_list()
values=full_table.values.tolist()
# Add a table at the bottom of the axes
colors = [["#56b5fd","w","w","w","w","w","w"],[ "#1ac3f5","w","w","w","w","w","w"]]
# Add a table at the bottom of the axes
colors = [["w","w","w","w","w","w"],[ "w","w","w","w","w","w"],
[ "w","w","w","w","w","w"],[ "w","w","w","w","w","w"],
[ "w","w","w","w","w","w"],[ "w","w","w","w","w","w"],
[ "w","w","w","w","w","w"],[ hc,hc,hc,hc,hc,hc]]
colors1 = ["w","w","w","w","w","w","w",hc]
colors2 = [ hc,hc,hc,hc,hc,hc]
fig, ax = plt.subplots()
ax.axis('off')
the_table = ax.table(cellText=values,cellColours=colors,
colLabels=columns,colColours=colors2,rowLabels=index, rowColours=colors1,loc='center')
plt.show()
The first option looks already quite okay. Some minor changes, but I cant get the bottom row to become blue. And the column headers do not fit.
The second option is blurry, top left corner remains empty, and much more editing of fonts should be done which I did not succeed with either.
Am I just using not the right libraries. Stuck on some simple formatting that is done with Excel in a minute.