From 328e27fc4d3b03f6b09d179997e3c94ea3215cc7 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Fri, 15 Aug 2025 17:49:26 -0500 Subject: [PATCH] bug fix: pandas update column with indexer --- smart/top/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smart/top/__init__.py b/smart/top/__init__.py index 0fdb2c7..eacc3f8 100644 --- a/smart/top/__init__.py +++ b/smart/top/__init__.py @@ -115,6 +115,7 @@ def read(**args) : if 'user' in args and args['user'] : _users = ",".join([ f"'{_name.strip()}'"for _name in args['user'].split(",")]) df = df.query(f"user in ({_users})") + # # For security reasons lets has the args columns with an MD5 or sha256 # @@ -122,7 +123,8 @@ def read(**args) : # if not df.empty and 'args' in df : # df.args = [hashlib.md5(str(value).encode('utf-8')).hexdigest() for value in df.args.tolist()] STATUS = {'R':'RUNNING','Z':'DEAD','D':'STASIS','S':'SLEEP','Sl':'SLEEP','Ss':'SLEEP','W':'PAGING','T':'DEAD'} - df.status = df.status.apply(lambda value: STATUS.get(value,'UNKNOWN')) + df.loc[:, 'status'] = df.status.apply(lambda value: STATUS.get(value,'UNKNOWN')) + if 'cols' in args : _cols = list(set(df.columns.tolist()) & set(args['cols'])) if _cols :