Skip to content

Commit 52cc8d4

Browse files
author
Michael Erickson
committed
Removed inplace parameter
1 parent b32c238 commit 52cc8d4

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

swat/cas/table.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5959,7 +5959,7 @@ def drop_duplicates(self, casout, subset=[]):
59595959
# def reindex_like(self, *args, **kwargs):
59605960
# raise NotImplementedError
59615961

5962-
def rename(self, columns, errors='ignore', inplace=True, **kwargs):
5962+
def rename(self, columns, errors='ignore', **kwargs):
59635963
'''
59645964
Rename columns of the CASTable.
59655965
@@ -5976,18 +5976,12 @@ def rename(self, columns, errors='ignore', inplace=True, **kwargs):
59765976
-------
59775977
:class:`CASTable`
59785978
'''
5979-
#If we are working in place, our working table is the table itself
5980-
table = self
5981-
#If not, we need to make a copy
5982-
if not inplace:
5983-
table = copy.deepcopy(self)
5984-
59855979
#Columns is a dict:
59865980
alterTable = []
59875981
if isinstance(columns, dict):
59885982
#Convert Pandas-style dict to CAS-style list of dicts
59895983
for oldName, newName in columns.items():
5990-
if oldName in table.columns:
5984+
if oldName in self.columns:
59915985
alterTable.append({'name': oldName, 'rename': newName})
59925986
#If we encounter a key that doesn't exist as column
59935987
#and we are raising errors, we do that here
@@ -5997,14 +5991,14 @@ def rename(self, columns, errors='ignore', inplace=True, **kwargs):
59975991
#Columns is a function:
59985992
elif callable(columns):
59995993
#Iterate through all table columns and apply function
6000-
for col in table.columns:
5994+
for col in self.columns:
60015995
alterTable.append({'name': col, 'rename': columns(col)})
60025996
else:
60035997
raise TypeError("Columns must be a dict or function")
60045998

60055999
#Use list of dicts to rename using alterTable action
6006-
table._retrieve('alterTable', columns=alterTable)
6007-
return table
6000+
self._retrieve('alterTable', columns=alterTable)
6001+
return self
60086002

60096003
def reset_index(self, level=None, drop=False, inplace=False,
60106004
col_level=0, col_fill='', **kwargs):

0 commit comments

Comments
 (0)