termgraph icon indicating copy to clipboard operation
termgraph copied to clipboard

Is it possible to plot pandas Dataframe?

Open mzfr opened this issue 7 years ago • 3 comments

Is it possible to plot a pandas dataframe with termgraph? Or is there any other work around for getting the dataframe to be plotted on terminal ?

mzfr avatar Sep 24 '18 13:09 mzfr

Same question, if not I want to builds a tk window to show my charts! :(

ghost avatar Oct 15 '18 22:10 ghost

@mzfr I think it might be possible, but how would you want to call termgraph?

The easiest way would seem to be export to CSV using pandas.DataFrame.to_csv and pipe that to termgraph. There is so some talk about API-izing termgraph so it could be called from within other programs, but I haven't done any work on that yet.

mkaz avatar Oct 20 '18 13:10 mkaz

Yes, it is possible, as said by @mkaz, you can export data as .csv file then call it. But pandas dataframes include a row for column names, and a first column for index.

e.g. #....Answer...Total 0.........Yes.......10 1..........No.........5

To plot it correctly you need to remove them: your_dataframe.to_csv('your_export.csv', header=False, index=False)

Then call it using termgraph: termgraph your_export.csv

Yes: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 10.00 No : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 5.00

YOUN3SS avatar Dec 31 '20 21:12 YOUN3SS