wey-gu / jupyter_nebulagraph

NebulaGraph Queries and visualization in Jupyter notebook.(previously known as ipython-ngql)
https://jupyter-nebulagraph.readthedocs.io/en/stable/
Other
29 stars 3 forks source link

%ng_draw is with issues on JupyterLabs #4

Closed cooler810 closed 6 months ago

cooler810 commented 1 year ago

使用jupyter lab时 查询语句在当前单元格返回结果正常显示为dataframe,但是在下一个单元格使用_ 查看数据类型为str,导致使使用%ng_draw 数据类型错误

jupyter lab 版本 3.0.14

%ng_draw

--------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-93-ef87c9714868> in <module>
----> 1 get_ipython().run_line_magic('ng_draw', '')

~/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2342                 kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2343             with self.builtin_trap:
-> 2344                 result = fn(*args, **kwargs)
   2345             return result
   2346 

~/anaconda3/lib/python3.8/site-packages/decorator.py in fun(*args, **kw)
    230             if not kwsyntax:
    231                 args, kw = fix(args, kw, sig)
--> 232             return caller(func, *(extras + args), **kw)
    233     fun.__name__ = func.__name__
    234     fun.__doc__ = func.__doc__

~/anaconda3/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~/anaconda3/lib/python3.8/site-packages/ngql/magic.py in ng_draw(self, line, cell, local_ns)
    280             return "No result found, please execute a query first."
    281         result_df = local_ns[variable_name]
--> 282         assert isinstance(result_df, pd.DataFrame), "Result is not in Pandas DataFrame Style"
    283 
    284         # Create a graph

AssertionError: Result is not in Pandas DataFrame Style
wey-gu commented 1 year ago

Thanks! I'll look into this later :)

Kindly use the notebook(not labs) first before it's fixed.

wey-gu commented 10 months ago

I guess you encountered this error because you enabled the IPythonNGQL.ngql_result_style as raw.

%config IPythonNGQL.ngql_result_style="raw"

see more from here

I set 3.0.14 jupyterlab up today and it's not reproduced at all, see

Screenshot 2023-09-18 at 15 06 48

wey-gu commented 6 months ago

closing as not being able to reproduced.

wey-gu commented 3 months ago
ng_draw_demo
wey-gu commented 3 months ago
ng_draw_schema_demo
wey-gu commented 3 months ago
ng_draw_demo_1