Forráskód Böngészése

bug fix: pandas update column with indexer

Steve Nyemba 1 hónapja
szülő
commit
328e27fc4d
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      smart/top/__init__.py

+ 3 - 1
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 :