Kanaries / pygwalker

PyGWalker: Turn your pandas dataframe into an interactive UI for visual analysis
https://kanaries.net/pygwalker
Apache License 2.0
13.43k stars 700 forks source link

Can I put pygwalker into django web application? #94

Closed eternal-bug closed 1 year ago

eternal-bug commented 1 year ago

Hello!

It is a wonderful module. I am a beginner in django. Is it possible to use this application inside an html div tag?(The file is uploaded through the front end and then processed in the background to return the graphic display and editor to the front end.) Thanks.

Asm-Def commented 1 year ago

Yes, please refer to the document of pyg.to_html (call help(pyg.to_html) in python for it).

eternal-bug commented 1 year ago

Thank you very much! I'll try it.

P3RI9 commented 1 year ago

Yes, please refer to the document of pyg.to_html (call help(pyg.to_html) in python for it).

Hi, I've tried to insert pygwalker into a Django div with mark_safe and file keeps loading forever. Looking at JavaScript console it throws this error twice: TypeError: t is undefined

This is my view:

from django.shortcuts import render
import pandas as pd
import pygwalker as pyg
from django.utils.safestring import mark_safe
def test(request):

    df = pd.read_csv("https://kanaries-app.s3.ap-northeast-1.amazonaws.com/public-datasets/bike_sharing_dc.csv",
                     parse_dates=['date'])
    div = mark_safe(pyg.to_html(df))
    return render(request, 'tests.html', {'div': div})

And in template I simply do {{ div }}

Could you help me with this? Thanks