c# Dataframe - how to visualize dataframe in a not notebook app

65 Views Asked by At

how to visualize a dataframe in a NOT NOTEBOOK APP (in a console application e.g.)

using a library like XPlot.Plotly in a console application

var data = Enumerable.Range(0, 100).Select(v => v + .0);
Chart.Bar(data).Show();

it opens the browser automatically and shows me a chart.

But, how if i want to visualize the entire dataframe in tabular format?

i've tried to configure a Formatter but how to visualize?

Formatter.Register<DataFrame>((df, writer) =>
{
    var headers = new List<IHtmlContent>();
    headers.Add(th(i("index")));
    headers.AddRange(df.Columns.Select(c => (IHtmlContent)th(c.Name)));
    var rows = new List<List<IHtmlContent>>();
    var take = 20;
    for (var i = 0; i < Math.Min(take, df.Rows.Count); i++)
    {
        var cells = new List<IHtmlContent>();
        cells.Add(td(i));
        foreach (var obj in df.Rows[i])
        {
            cells.Add(td(obj));
        }
        rows.Add(cells);
    }

    var t = table(
        thead(
            headers),
        tbody(
            rows.Select(
                r => tr(r))));

    writer.Write(t);
}, "text/html");

It seems to work in a notebook only, how can "to pass" this formatter to XPlot (or another library) in order to open the browser and show it ( like Chart.Bar(data).Show(); does?

0

There are 0 best solutions below