diff --git a/python/helpers/pydev/_pydevd_bundle/tables/pydevd_dataset.py b/python/helpers/pydev/_pydevd_bundle/tables/pydevd_dataset.py index 97b586ec0b43..b78e0b4b76fb 100644 --- a/python/helpers/pydev/_pydevd_bundle/tables/pydevd_dataset.py +++ b/python/helpers/pydev/_pydevd_bundle/tables/pydevd_dataset.py @@ -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): diff --git a/python/helpers/pydev/_pydevd_bundle/tables/pydevd_pandas.py b/python/helpers/pydev/_pydevd_bundle/tables/pydevd_pandas.py index 3b95497fd025..e24b567ce8c9 100644 --- a/python/helpers/pydev/_pydevd_bundle/tables/pydevd_pandas.py +++ b/python/helpers/pydev/_pydevd_bundle/tables/pydevd_pandas.py @@ -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):