You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to use a property of an object as the key when providing the object to a DataFrame?
I think the code makes clearer what I am looking for.
classKey:
def__init__(self, name: str):
self.name=name# Something like thatdef__pandas_key__(self):
returnself.namedf=DataFrame({"col": [1,2,3,4]})
key=Key("col")
df[key] # is [1,2,3,4]
The text was updated successfully, but these errors were encountered:
Is there a way to use a property of an object as the key when providing the object to a DataFrame?
I think the code makes clearer what I am looking for.
The text was updated successfully, but these errors were encountered: