File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 2020 'protobuf >=3.6, <4' ,
2121 'grpcio >=1.17, <2' ,
2222 'ipython>=1.0' ,
23- 'prettytable ' ,
23+ 'pandas ' ,
2424]
2525SETUP_REQUIRED = [
2626 'pytest-runner'
Original file line number Diff line number Diff line change 1-
2-
31class Rows :
42 def __init__ (self , column_names , rows_gen ):
53 """Query result of sqlflow.client.Client.execute
@@ -42,15 +40,19 @@ def __str__(self):
4240 return self .__repr__ ()
4341
4442 def __repr__ (self ):
45- from prettytable import PrettyTable
46- table = PrettyTable (self ._column_names )
47- for row in self .rows ():
48- table .add_row (row )
49- return table .__str__ ()
43+ return self .to_dataframe ().__repr__ ()
44+
45+ def _repr_html_ (self ):
46+ return self .to_dataframe ()._repr_html_ ()
5047
5148 def to_dataframe (self ):
5249 """Convert Rows to pandas.Dataframe
5350
5451 :return: pandas.Dataframe
5552 """
56- raise NotImplementedError
53+ # Fetch all the rows to self._rows
54+ for r in self .rows ():
55+ pass
56+ import pandas as pd
57+ return pd .DataFrame (self ._rows , columns = self ._column_names )
58+
You can’t perform that action at this time.
0 commit comments