我能否从accessor class中访问pandas DataFrame
,并使accessor类中的方法通过df.myaccessor.calc_displacement()
对df
中的x
和y
列进行操作?
但实际上,我只能访问到在accessor中可见的pandas DataFrame _obj
。但是更新_obj
不会更新df
。
从dir(self)
中访问accessor类:
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_obj', '_validate']
Pandas版本为0.24.2。