我正在寻找修复一个即将被解释的方法qazxsw poi与建议的qazxsw poi
from_items
当我在df赋值时更改为from_dict
:
pd.set_option('display.max_columns', 50)
pd.set_option('display.max_rows', 50)
Test_Data = [('originating_system_id', ['CL', 'CL', 'CL', 'CL']),
('security_type1', ['CORP', 'CORP', 'CORP', 'CORP']),
('state', ['Traded', 'Covered', 'Traded Away', 'Traded']),
('trading_book', ['LCAAAAA', 'NUBBBBB', 'EDFGSFG', 'PDFEFGR'])
]
df = pd.DataFrame.from_items(Test_Data)
print(df)
originating_system_id security_type1 state trading_book
0 CL CORP Traded LCAAAAA
1 CL CORP Covered NUBBBBB
2 CL CORP Traded Away EDFGSFG
3 CL CORP Traded PDFEFGR
我希望应用过滤器时出现以下行错误:
from_dict
df = pd.DataFrame.from_dict(Test_Data)
结构不同吗?有没有替代m1 = ~df['trading_book'].str.startswith(tuple(prefixes))
KeyError: 'trading_book'
?
对我来说工作很好,将其转换为字典:
from_dict
详情:
from_items