I currently have a python script that analyzes a jstack dump and outputs a dataframe like this:
I want to turn this into a png or jpg image of a table containing this data. Something simple like this:
Does anyone know what the easiest, most straight forward way to produce an image like this so it is saved in the same path that I am running the code?
Thank you! Javier
***EDIT:
The provided solutions are outputting an unreadable table with mostly white space as below:
Can anyone suggest what I'm doing wrong and which parameters to adjust?
***EDIT #2:
Here is my code:
df = pd.DataFrame(table_data, columns = ["Method Name", "# of threads", "% of threads"])
ax = plt.subplot(111, frame_on=False)
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
t = table(ax, df)
t.auto_set_font_size(False)
t.set_fontsize(12)
fig.savefig("test.png")
And the current output:
***EDIT #3:
This is the dataframe I am passing:
Method Name # of threads % of threads
0 at sun.nio.ch.EPollArrayWrapper.epollWait(Nati... 33 32.35
1 at sun.misc.Unsafe.park(Native Method) 29 28.43
2 NO JAVA STACK TRACE 18 17.64
3 at java.net.PlainSocketImpl.socketAccept(Nativ... 6 05.88
4 at xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx... 5 04.90
5 at java.lang.Object.wait(Native Method) 4 03.92
6 at java.lang.Thread.sleep(Native Method) 3 02.94
7 at java.net.SocketInputStream.socketRead0(Nati... 3 02.94
8 at sun.nio.ch.ServerSocketChannelImpl.accept0(... 1 00.98