Skip to content

Commit

Permalink
Upgrade to Pandas 2.x (#658)
Browse files Browse the repository at this point in the history
* Upgrade to Pandas 2.x

* Retain 3.8 compatibility

* update changelog
  • Loading branch information
michaelnchin authored Jul 31, 2024
1 parent fba675a commit 064f6d1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Starting with v1.31.6, this file will contain a record of major features and upd
- Added `%create_graph_snapshot` line magic ([Link to PR](https://github.com/aws/graph-notebook/pull/653))
- Added better `%reset` user messaging on status check timeout ([Link to PR](https://github.com/aws/graph-notebook/pull/652))
- Modified the `%reset --snapshot` option to use the CreateGraphSnapshot API ([Link to PR](https://github.com/aws/graph-notebook/pull/654))
- Upgraded `pandas` dependency to 2.x ([Link to PR](https://github.com/aws/graph-notebook/pull/658))
- Upgraded `setuptools` dependency to 70.x ([Link to PR](https://github.com/aws/graph-notebook/pull/649))
- Experimental support for Python 3.11 ([PR #1](https://github.com/aws/graph-notebook/pull/645)) ([PR #2](https://github.com/aws/graph-notebook/pull/656))
- Updated sample SageMaker Lifecycle scripts ([Link to PR](https://github.com/aws/graph-notebook/pull/657))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nbconvert>=6.3.0,<=7.2.8
jedi>=0.18.1,<=0.18.2
markupsafe<2.1.0
itables>=2.0.0,<=2.1.0
pandas>=1.3.5,<=1.5.3
pandas>=2.0.0,<=2.2.2
numpy<1.24.0
nest_asyncio>=1.5.5,<=1.5.6
async-timeout>=4.0,<5.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_version():
'nbconvert>=6.3.0,<=7.2.8',
'jedi>=0.18.1,<=0.18.2',
'itables>=2.0.0,<=2.1.0',
'pandas>=1.3.5,<=1.5.3',
'pandas>=2.0.0,<=2.2.2',
'numpy<1.24.0',
'nest_asyncio>=1.5.5,<=1.5.6',
'async-timeout>=4.0,<5.0'
Expand Down
6 changes: 3 additions & 3 deletions src/graph_notebook/magics/graph_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def oc_results_df(oc_res, oc_res_format: str = None):
if rows_and_columns:
results_df = pd.DataFrame(rows_and_columns['rows'])
results_df = results_df.astype(str)
results_df = results_df.applymap(lambda x: encode_html_chars(x))
results_df = results_df.map(lambda x: encode_html_chars(x))
col_0_value = range(1, len(results_df) + 1)
results_df.insert(0, "#", col_0_value)
for col_index, col_name in enumerate(rows_and_columns['columns']):
Expand Down Expand Up @@ -292,7 +292,7 @@ def encode_html_chars(result):

def decode_html_chars(results_df: pd.DataFrame = None) -> pd.DataFrame:
for k, v in iter(DT_HTML_CHAR_MAP.items()):
results_df = results_df.applymap(lambda x: x.replace(v, k))
results_df = results_df.map(lambda x: x.replace(v, k))

return results_df

Expand Down Expand Up @@ -896,7 +896,7 @@ def sparql(self, line='', cell='', local_ns: dict = None):
if rows_and_columns is not None:
results_df = pd.DataFrame(rows_and_columns['rows'])
results_df = results_df.astype(str)
results_df = results_df.applymap(lambda x: encode_html_chars(x))
results_df = results_df.map(lambda x: encode_html_chars(x))
results_df.insert(0, "#", range(1, len(results_df) + 1))
for col_index, col_name in enumerate(rows_and_columns['columns']):
try:
Expand Down

0 comments on commit 064f6d1

Please sign in to comment.