SWDesk

[Pytyon] DataFrame - dict

inhae 2022. 7. 25. 10:55

특정한 내용을 갖는 행을 dict로 변환하여 반환

 

        tagIndex = self.TagInfosDF.index[self.TagInfosDF['TagID']==tagID].tolist()
        if not tagIndex:
            print("[?] Unknown TagID")
            return None
        tagInfo1 = self.TagInfosDF.loc[tagIndex[0]].to_dict()
        if not tagInfo1:
            print("[?] Wrong TagID input")
            return None
반응형