Closed midas628 closed 1 year ago
position 357182: is "—" in the "graphic-walker.umd.js" :or omitted — the behavior is unsupported
fix by add encoding='utf-8' in base.py. I am curious why the default encoding mode is GBK(because I use chinese lauguage?)
Just find my version is 0.1.0 cause I down load it from mirror from another website. Issue fixed after use 0.1.4.7
CODE: import pandas as pd import pygwalker as pyg
df = pd.read_csv(r'E:\VSCODE\QSPR_loss_cal\2.csv') gwalker = pyg.walk(df)
ERROR: UnicodeDecodeError Traceback (most recent call last) Cell In[13], line 5 2 import pygwalker as pyg 4 df = pd.read_csv(r'E:\VSCODE\QSPR_loss_cal\2.csv') ----> 5 gwalker = pyg.walk(df)
File ~\AppData\Roaming\Python\Python38\site-packages\pygwalker\gwalker.py:84, in walk(df, gid, **kwargs) 79 props = { 80 'dataSource': to_records(df), 81 'rawFields': raw_fields(df), 82 } 83 html = render_gwalker_html(gid) ---> 84 js = render_gwalker_js(gid, props) 86 display(HTML(html)) 87 display(Javascript(js))
File ~\AppData\Roaming\Python\Python38\site-packages\pygwalker\gwalker.py:65, in render_gwalker_js(gid, props) 63 walker_template = jinja_env.get_template("walk.js") 64 js = walker_template.render(gwalker={'id': gid, 'props': json.dumps(props, cls=DataFrameEncoder)} ) ---> 65 return gwalker_script() + js
File ~\AppData\Roaming\Python\Python38\site-packages\pygwalker\base.py:15, in gwalker_script() 13 if gwalker_js is None: 14 with open(os.path.join(HERE, 'templates', 'graphic-walker.umd.js'), 'r') as f: ---> 15 gwalker_js = "const process={env:{NODE_ENV:\"production\"} };" + f.read() 16 return gwalker_js
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 357182: illegal multibyte sequence