import pandas as pd
class TestDataFrame(pd.DataFrame):
_metadata = ['testattr']
@property
def _constructor(self):
return TestDataFrame
df = TestDataFrame({0: [1, 2, 3], 1: [1, 2, 3]})
df.testattr = 'XXX'
df.testattr
# XXX
# Using list is OK
df.iloc[[0, 1], :].testattr
# XXX
# Using slice is NG
df.iloc[0:1, :].testattr
# AttributeError: 'TestDataFrame' object has no attribute 'testattr'
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4