Skip to content

Commit

Permalink
pd.read_json: avoid deprecation warning by wrapping string in StringIO
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jul 28, 2024
1 parent df709b4 commit c1612d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions navis/io/json_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

import io
import json

import pandas as pd
Expand Down Expand Up @@ -140,13 +141,13 @@ def read_json(s: str, **kwargs) -> 'core.NeuronList':

if '_nodes' in n:
try:
cn._nodes = pd.read_json(n['_nodes'])
cn._nodes = pd.read_json(io.StringIO(n['_nodes']))
except ValueError:
cn._nodes = None

if '_connectors' in n:
try:
cn._connectors = pd.read_json(n['_connectors'])
cn._connectors = pd.read_json(io.StringIO(n['_connectors']))
except ValueError:
cn._connectors = None

Expand Down

0 comments on commit c1612d1

Please sign in to comment.