Skip to content

Commit

Permalink
Pandas deprecated parameter fix
Browse files Browse the repository at this point in the history
The inplace=True keyword was removed from newer Pandas versions, thus the inplace option is replaced by re-assigning the variable, following Pandas recs (pandas-dev/pandas#57104)
Changing df['popInd'].cat.set_categories(sim.net.pops.keys(), inplace=True) by df['popInd'] = df['popInd'].cat.set_categories(sim.net.pops.keys()) in analysis/spikes.py
  • Loading branch information
RomanB22 committed Mar 27, 2024
1 parent a7c06ec commit b35b841
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions netpyne/analysis/spikes.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def prepareSpikeData(
orderBy = 'gid'
elif orderBy == 'pop':
df['popInd'] = df['pop'].astype('category')
df['popInd'].cat.set_categories(sim.net.pops.keys(), inplace=True)
df['popInd'] = df['popInd'].cat.set_categories(sim.net.pops.keys())
orderBy = 'popInd'
elif isinstance(orderBy, basestring) and not isinstance(cells[0]['tags'][orderBy], Number):
orderBy = 'gid'

if isinstance(orderBy, list):
if 'pop' in orderBy:
df['popInd'] = df['pop'].astype('category')
df['popInd'].cat.set_categories(sim.net.pops.keys(), inplace=True)
df['popInd'] = df['popInd'].cat.set_categories(sim.net.pops.keys())
orderBy[orderBy.index('pop')] = 'popInd'
keep = keep + list(set(orderBy) - set(keep))
elif orderBy not in keep:
Expand Down

0 comments on commit b35b841

Please sign in to comment.