[pycharm] PY-72208 Tables(Jupyter, SciView): Refactoring, fix tiny errors

GitOrigin-RevId: a936672fbdf51c9692150bd7c78721988abde3f7
This commit is contained in:
ekaterina.itsenko
2024-10-02 19:02:08 +02:00
committed by intellij-monorepo-bot
parent 2b3832d5a9
commit cefb5228e1
2 changed files with 22 additions and 14 deletions

View File

@@ -49,23 +49,27 @@ def get_data(table, use_csv_serialization, start_index=None, end_index=None, for
return computed_data
def __ipython_display(data):
from IPython.display import display
display(data)
# used by DSTableCommands
# noinspection PyUnresolvedReferences
def display_data_csv(table, start_index, end_index):
# type: (datasets.arrow_dataset.Dataset, int, int) -> None
_compute_sliced_data(table, __ipython_display, start_index, end_index)
def ipython_display(data):
try:
data = data.to_csv()
except AttributeError:
pass
print(data)
_compute_sliced_data(table, ipython_display, end_index)
# used by DSTableCommands
# noinspection PyUnresolvedReferences
def display_data_html(table, start_index, end_index):
# type: (datasets.arrow_dataset.Dataset, int, int) -> None
_compute_sliced_data(table, __ipython_display, start_index, end_index)
def ipython_display(data):
from IPython.display import display
display(data)
_compute_sliced_data(table, ipython_display, end_index)
def __get_data_slice(table, start, end):

View File

@@ -50,23 +50,27 @@ def get_data(table, use_csv_serialization, start_index=None, end_index=None, for
return computed_data
def __ipython_display(data):
from IPython.display import display
display(__convert_to_df(data))
# used by DSTableCommands
# noinspection PyUnresolvedReferences
def display_data_csv(table, start_index, end_index):
# type: (Union[pd.DataFrame, pd.Series], int, int) -> None
_compute_sliced_data(table, __ipython_display, start_index, end_index)
def ipython_display(data):
try:
data = data.to_csv()
except AttributeError:
pass
print(__convert_to_df(data))
_compute_sliced_data(table, ipython_display, start_index, end_index)
# used by DSTableCommands
# noinspection PyUnresolvedReferences
def display_data_html(table, start_index, end_index):
# type: (Union[pd.DataFrame, pd.Series], int, int) -> None
_compute_sliced_data(table, __ipython_display, start_index, end_index)
def ipython_display(data):
from IPython.display import display
display(__convert_to_df(data))
_compute_sliced_data(table, ipython_display, start_index, end_index)
def __get_data_slice(table, start, end):