dfply

dfply: Mutating string column: TypeError

[亡魂溺海] 提交于 2019-12-23 12:37:25
问题 My pandas dataframe contains a column "file" which are strings with a file path. I am trying to use dfply to mutate this column like resultstatsDF.reset_index() >> mutate(dirfile = os.path.join(os.path.basename(os.path.dirname(X.file)),os.path.basename(X.file))) but I get the error TypeError: __index__ returned non-int (type Call) What did I do wrong? How do I do it right? 回答1: Since my question was up-voted, I guess, it is still interesting to some people. Having learned quite a bit in