|
22 | 22 | from uuid import uuid4
|
23 | 23 | from six import string_types
|
24 | 24 |
|
25 |
| -# versions of pandas prior to version 0.20.0 don't support the orient='table' |
26 |
| -# when calling the 'to_json' function on DataFrames. to get around this we |
27 |
| -# have our own copy of the panda's 0.20.0 implementation that we use for old |
28 |
| -# versions of pandas. |
29 |
| -from distutils.version import LooseVersion |
30 |
| -if LooseVersion(pd.__version__) > LooseVersion('0.20.0'): |
31 |
| - import pandas.io.json as pd_json |
32 |
| -else: |
33 |
| - from . import pd_json |
34 |
| - |
35 | 25 |
|
36 | 26 | class _DefaultSettings(object):
|
37 | 27 |
|
@@ -957,10 +947,12 @@ def should_be_stringified(col_series):
|
957 | 947 | else:
|
958 | 948 | self._row_styles = {}
|
959 | 949 |
|
960 |
| - df_json = pd_json.to_json(None, df, |
961 |
| - orient='table', |
962 |
| - date_format='iso', |
963 |
| - double_precision=self.precision) |
| 950 | + df_json = df.to_json( |
| 951 | + None, |
| 952 | + orient='table', |
| 953 | + date_format='iso', |
| 954 | + double_precision=self.precision, |
| 955 | + ) |
964 | 956 |
|
965 | 957 | if update_columns:
|
966 | 958 | self._interval_columns = []
|
@@ -1037,10 +1029,10 @@ def should_be_stringified(col_series):
|
1037 | 1029 | # and then call 'to_json' again to get a new version of the table
|
1038 | 1030 | # json that has interval columns replaced with text columns
|
1039 | 1031 | if len(self._interval_columns) > 0 or len(self._period_columns) > 0:
|
1040 |
| - df_json = pd_json.to_json(None, df, |
1041 |
| - orient='table', |
1042 |
| - date_format='iso', |
1043 |
| - double_precision=self.precision) |
| 1032 | + df_json = df.to_json(None, |
| 1033 | + orient='table', |
| 1034 | + date_format='iso', |
| 1035 | + double_precision=self.precision) |
1044 | 1036 |
|
1045 | 1037 | self._df_json = df_json
|
1046 | 1038 |
|
|
0 commit comments