Is it possible to plot pandas Dataframe?
Opened this issue · 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 ?
Same question, if not I want to builds a tk window to show my charts! :(
@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.
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